home *** CD-ROM | disk | FTP | other *** search
- package com.ibm.xml.internal;
-
- import com.ibm.xml.framework.AttDef;
- import com.ibm.xml.framework.Attr;
- import com.ibm.xml.framework.AttrPool;
- import com.ibm.xml.framework.ChunkyCharArray;
- import com.ibm.xml.framework.ContentSpecNode;
- import com.ibm.xml.framework.ElementDecl;
- import com.ibm.xml.framework.ElementDeclPool;
- import com.ibm.xml.framework.EntityDecl;
- import com.ibm.xml.framework.EntityPool;
- import com.ibm.xml.framework.NotationDecl;
- import com.ibm.xml.framework.ParserState;
- import com.ibm.xml.framework.ScanContentState;
- import com.ibm.xml.framework.StringPool;
- import com.ibm.xml.framework.XMLDocumentHandler;
- import com.ibm.xml.framework.XMLDocumentTypeHandler;
- import com.ibm.xml.framework.XMLEntityHandler;
- import com.ibm.xml.framework.XMLErrorHandler;
- import com.ibm.xml.framework.XMLReader;
- import com.ibm.xml.framework.XMLScanner;
- import com.ibm.xml.framework.XMLValidationHandler;
- import java.io.UnsupportedEncodingException;
- import org.xml.sax.InputSource;
- import org.xml.sax.Locator;
-
- public class DefaultScanner implements XMLScanner, Locator {
- private static final boolean DEBUG_STOP = false;
- private static final boolean DEBUG_NMTOKEN_ENTITY = false;
- private static final int ST_NORMAL = 1;
- private static final int ST_INTERNAL_SUBSET = 2;
- private static final int ST_EXTERNAL_SUBSET = 3;
- private static final byte GENERAL_ENTITY_TYPE = 0;
- private static final byte PARAMETER_ENTITY_TYPE = 1;
- private static final char[] cdata_string = new char[]{'C', 'D', 'A', 'T', 'A'};
- private static final char[] xml_string = new char[]{'x', 'm', 'l'};
- private static final char[] version_string = new char[]{'v', 'e', 'r', 's', 'i', 'o', 'n'};
- private static final char[] doctype_string = new char[]{'D', 'O', 'C', 'T', 'Y', 'P', 'E'};
- private static final char[] standalone_string = new char[]{'s', 't', 'a', 'n', 'd', 'a', 'l', 'o', 'n', 'e'};
- private static final char[] yes_string = new char[]{'y', 'e', 's'};
- private static final char[] no_string = new char[]{'n', 'o'};
- private static final char[] element_string = new char[]{'E', 'L', 'E', 'M', 'E', 'N', 'T'};
- private static final char[] empty_string = new char[]{'E', 'M', 'P', 'T', 'Y'};
- private static final char[] any_string = new char[]{'A', 'N', 'Y'};
- private static final char[] pcdata_string = new char[]{'#', 'P', 'C', 'D', 'A', 'T', 'A'};
- private static final char[] attlist_string = new char[]{'A', 'T', 'T', 'L', 'I', 'S', 'T'};
- private static final char[] id_string = new char[]{'I', 'D'};
- private static final char[] ref_string = new char[]{'R', 'E', 'F'};
- private static final char[] entit_string = new char[]{'E', 'N', 'T', 'I', 'T'};
- private static final char[] ies_string = new char[]{'I', 'E', 'S'};
- private static final char[] nmtoken_string = new char[]{'N', 'M', 'T', 'O', 'K', 'E', 'N'};
- private static final char[] notation_string = new char[]{'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N'};
- private static final char[] required_string = new char[]{'#', 'R', 'E', 'Q', 'U', 'I', 'R', 'E', 'D'};
- private static final char[] implied_string = new char[]{'#', 'I', 'M', 'P', 'L', 'I', 'E', 'D'};
- private static final char[] fixed_string = new char[]{'#', 'F', 'I', 'X', 'E', 'D'};
- private static final char[] include_string = new char[]{'I', 'N', 'C', 'L', 'U', 'D', 'E'};
- private static final char[] ignore_string = new char[]{'I', 'G', 'N', 'O', 'R', 'E'};
- private static final char[] entity_string = new char[]{'E', 'N', 'T', 'I', 'T', 'Y'};
- private static final char[] system_string = new char[]{'S', 'Y', 'S', 'T', 'E', 'M'};
- private static final char[] public_string = new char[]{'P', 'U', 'B', 'L', 'I', 'C'};
- private static final char[] ndata_string = new char[]{'N', 'D', 'A', 'T', 'A'};
- private static final char[] encoding_string = new char[]{'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g'};
- private static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
- protected ParserState fParserState;
- private int fScannerState = 1;
- private int fScannerMarkupDepth;
- private int fScannerParenDepth;
- private XMLReader fReader;
- private boolean fStandalone = false;
- private boolean fCalledStartDocument = false;
- protected XMLDocumentHandler fDocumentHandler;
- protected XMLDocumentTypeHandler fDocumentTypeHandler;
- protected XMLValidationHandler fValidationHandler;
- protected XMLEntityHandler fEntityHandler;
- protected XMLErrorHandler fErrorHandler;
- protected StringPool fStringPool;
- protected AttrPool fAttrPool;
- protected EntityPool fEntityPool;
- protected ElementDeclPool fElementDeclPool;
- private ChunkyCharArray fLiteralData;
- private EntityPool fParameterEntityPool;
- private int fXMLSymbolIndex = -1;
- private Attr fAttr = new Attr();
- private int fAttValueIndex = -1;
- private char[] fCharRefData;
- private int fSystemLiteral = -1;
- private int fPubidLiteral = -1;
- private ElementDecl fElementDecl;
- private ContentSpecNode fContentSpecNode;
- private AttDef fAttDef;
- private NotationDecl fNotationDecl;
- private EntityDecl fEntityDecl;
- private XMLReader[] fReaderStack = new XMLReader[8];
- private InputSource[] fReaderSource = new InputSource[8];
- private int[] fReaderMarkupDepth = new int[8];
- private int[] fReaderParenDepth = new int[8];
- private int fReaderStackDepth;
- private int fActiveReaderLimit;
- private int[] fElementNameStack = new int[8];
- private int[] fElementChildCount = new int[8];
- private int[][] fElementChildren = new int[8][];
- private int fElementDepth = -1;
- private byte[] fEntityTypeStack;
- private int[] fEntityNameStack;
- private int fEntityStackDepth;
- private byte[] opStack;
- private int[] nodeIndexStack;
- private int[] prevNodeIndexStack;
- private boolean fStop = false;
- private static final boolean DEBUG_PAREN_DEPTH = false;
- private static final boolean DEBUG_MARKUP_DEPTH = false;
-
- public DefaultScanner(ParserState var1) {
- this.fParserState = var1;
- }
-
- public void reset(ParserState var1) {
- this.fParserState = var1;
- this.fStop = false;
- this.fCalledStartDocument = false;
- }
-
- public void refreshParserState(ParserState var1) {
- this.fDocumentHandler = this.fParserState.getDocumentHandler();
- this.fDocumentTypeHandler = this.fParserState.getDocumentTypeHandler();
- this.fEntityHandler = this.fParserState.getEntityHandler();
- this.fErrorHandler = this.fParserState.getErrorHandler();
- this.fValidationHandler = this.fParserState.getValidationHandler();
- this.fStringPool = this.fParserState.getStringPool();
- this.fAttrPool = this.fParserState.getAttrPool();
- this.fEntityPool = this.fParserState.getEntityPool();
- this.fElementDeclPool = this.fParserState.getElementDeclPool();
- }
-
- public Locator getLocator() {
- return this;
- }
-
- public String getPublicId() {
- return this.fReader == null ? null : this.fReader.getSystemId();
- }
-
- public String getSystemId() {
- return this.fReader == null ? null : this.fReader.getSystemId();
- }
-
- public int getLineNumber() {
- return this.fReader == null ? -1 : this.fReader.getLineNumber();
- }
-
- public int getColumnNumber() {
- return this.fReader == null ? -1 : this.fReader.getColumnNumber();
- }
-
- private void emitError(int var1) throws Exception {
- this.fErrorHandler.error(var1);
- }
-
- private void emitError(int var1, int var2) throws Exception {
- this.fErrorHandler.error1(var1, var2);
- }
-
- private void emitError(int var1, int var2, int var3) throws Exception {
- this.fErrorHandler.error2(var1, var2, var3);
- }
-
- public void stop() {
- this.fStop = true;
- }
-
- public void scanDocument(InputSource var1) throws Exception {
- this.refreshParserState(this.fParserState);
- this.fScannerState = 1;
- this.fLiteralData = new ChunkyCharArray(this.fStringPool);
- this.fParameterEntityPool = null;
- this.fXMLSymbolIndex = -1;
-
- try {
- this.fReader = this.fEntityHandler.createReader(var1, true);
- } catch (UnsupportedEncodingException var4) {
- int var3 = this.fStringPool.addString(((Throwable)var4).getMessage());
- this.fErrorHandler.error1(52, var3);
- return;
- } catch (Exception var5) {
- throw var5;
- }
-
- this.fEntityHandler.startInputSource(var1);
-
- try {
- this.scanProlog();
- if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
- this.fDocumentHandler.startDocument(-1, -1, -1);
- this.fCalledStartDocument = true;
- }
-
- this.fEntityPool.checkUnparsedEntities();
- int var2 = this.fReader.scanName('>', -1);
- if (var2 == -1) {
- this.fErrorHandler.error(122);
- } else {
- if (this.fValidationHandler != null) {
- this.fValidationHandler.checkRootElementName(var2);
- }
-
- if (this.scanElement(var2)) {
- if (this.fElementDepth >= 0) {
- ScanContentState var10 = new ScanContentState();
- var10.inCDSect = false;
- var10.extParsedEnt = false;
- var10.parseTextDecl = false;
- var10.elementDepth = 0;
- this.scanContent(var10);
- if (this.fValidationHandler != null) {
- this.fValidationHandler.checkIDRefNames();
- }
- }
-
- this.scanMisc();
- }
- }
- } catch (ArrayIndexOutOfBoundsException var6) {
- if (this.fElementDepth >= 0) {
- int var9 = this.fElementNameStack[this.fElementDepth];
- this.fErrorHandler.error1(124, var9);
- }
-
- if (this.fScannerMarkupDepth > 0) {
- this.fErrorHandler.error(116);
- }
- } catch (StopException var7) {
- } catch (Exception var8) {
- throw var8;
- }
-
- if (!this.fStop) {
- if (this.fDocumentHandler != null && this.fCalledStartDocument) {
- this.fDocumentHandler.endDocument();
- }
-
- this.fEntityHandler.endInputSource(var1);
- } else {
- while(this.fReaderStackDepth > 0) {
- this.fReaderStack[--this.fReaderStackDepth] = null;
- this.fReaderSource[this.fReaderStackDepth] = null;
- }
-
- }
- }
-
- public void scanDTD(InputSource var1) throws Exception {
- this.fDocumentHandler = this.fParserState.getDocumentHandler();
- this.fDocumentTypeHandler = this.fParserState.getDocumentTypeHandler();
- this.fEntityHandler = this.fParserState.getEntityHandler();
- this.fErrorHandler = this.fParserState.getErrorHandler();
- this.fValidationHandler = this.fParserState.getValidationHandler();
- this.fStringPool = this.fParserState.getStringPool();
- this.fAttrPool = this.fParserState.getAttrPool();
- this.fEntityPool = this.fParserState.getEntityPool();
- this.fElementDeclPool = this.fParserState.getElementDeclPool();
- this.fLiteralData = new ChunkyCharArray(this.fStringPool);
- this.fParameterEntityPool = null;
- this.fXMLSymbolIndex = -1;
- this.fScannerState = 3;
- this.fReader = this.fEntityHandler.createReader(var1, false);
- this.fEntityHandler.startInputSource(var1);
- if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
- this.fDocumentHandler.startDocument(-1, -1, -1);
- this.fCalledStartDocument = true;
- }
-
- int var2 = this.fStringPool.addSymbol("");
- this.fElementDeclPool.setRootElement(var2);
- if (this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.doctypeDecl(var2);
- }
-
- if (this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.startExternalSubset(-1, -1);
- }
-
- try {
- this.scanExtSubsetDecl(false);
- } catch (ArrayIndexOutOfBoundsException var4) {
- if (this.fScannerMarkupDepth > 0) {
- this.fErrorHandler.error(116);
- }
- } catch (StopException var5) {
- } catch (Exception var6) {
- throw var6;
- }
-
- if (this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.endExternalSubset();
- }
-
- if (this.fParserState.getValidationHandler() != null) {
- this.fElementDeclPool.checkDeclaredElements();
- }
-
- this.fEntityPool.checkUnparsedEntities();
- if (!this.fStop) {
- if (this.fDocumentHandler != null && this.fCalledStartDocument) {
- this.fDocumentHandler.endDocument();
- }
-
- this.fEntityHandler.endInputSource(var1);
- } else {
- while(this.fReaderStackDepth > 0) {
- this.fReaderStack[--this.fReaderStackDepth] = null;
- this.fReaderSource[this.fReaderStackDepth] = null;
- }
-
- }
- }
-
- private boolean scanEq() throws Exception {
- this.fReader.skipPastSpaces();
- if (this.fReader.skippedChar('=')) {
- this.fReader.skipPastSpaces();
- return true;
- } else {
- return false;
- }
- }
-
- private boolean scanComment(boolean var1) throws Exception {
- int var2 = this.fReader.currentOffset();
- boolean var3 = false;
-
- while(true) {
- boolean var4 = false;
-
- try {
- var4 = this.fReader.lookingAtChar('-');
- } catch (ArrayIndexOutOfBoundsException var10) {
- if ((this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1]) == 0) {
- this.fErrorHandler.error(21);
- }
-
- throw var10;
- }
-
- if (var4) {
- int var5 = this.fReader.currentOffset();
- int var6 = 0;
- int var7 = this.fReader.skipAsciiChar();
-
- int var8;
- for(var8 = 1; this.fReader.skippedChar('-'); var7 = this.fReader.currentOffset()) {
- ++var8;
- var6 = var5;
- var5 = var7;
- }
-
- if (var8 > 1) {
- if (this.fReader.skippedChar('>')) {
- if (!var3 && var8 > 2) {
- this.fErrorHandler.error(21);
- var3 = true;
- }
-
- --this.fScannerMarkupDepth;
- if (var1 && this.fDocumentHandler != null) {
- this.fDocumentHandler.comment(this.fReader.addString(var2, var6 - var2));
- }
-
- if (var3) {
- return false;
- }
-
- return true;
- }
-
- if (!var3) {
- this.fErrorHandler.error(22);
- var3 = true;
- }
- }
- } else {
- try {
- if (!this.fReader.skippedValidChar()) {
- this.fReader.skipInvalidChar(85);
- }
- } catch (ArrayIndexOutOfBoundsException var9) {
- if ((this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1]) == 0) {
- this.fErrorHandler.error(21);
- }
-
- throw var9;
- }
- }
- }
- }
-
- private void scanProlog() throws Exception {
- boolean var1 = true;
-
- while(true) {
- if (this.fReader.skippedChar('<')) {
- ++this.fScannerMarkupDepth;
- if (this.fReader.skippedChar('?')) {
- int var2 = this.fReader.scanName(' ', -1);
- if (var2 == -1) {
- this.fErrorHandler.error(102);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else if ("xml".equals(this.fStringPool.toString(var2))) {
- if (this.fReader.skippedSpace()) {
- if (var1) {
- this.scanXMLDecl();
- } else {
- this.fErrorHandler.error(117);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else {
- this.fErrorHandler.error(107);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else {
- if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
- this.fDocumentHandler.startDocument(-1, -1, -1);
- this.fCalledStartDocument = true;
- }
-
- this.scanPI(var2, true);
- }
- } else {
- if (!this.fReader.skippedChar('!')) {
- if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
- this.fDocumentHandler.startDocument(-1, -1, -1);
- this.fCalledStartDocument = true;
- }
-
- return;
- }
-
- if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
- this.fDocumentHandler.startDocument(-1, -1, -1);
- this.fCalledStartDocument = true;
- }
-
- if (this.fReader.skippedChar('-')) {
- if (this.fReader.skippedChar('-')) {
- this.scanComment(true);
- } else {
- this.fErrorHandler.error(20);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else if (this.fReader.skippedString(doctype_string)) {
- this.scanDoctypeDecl();
- } else {
- this.fErrorHandler.error(39);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- }
- } else if (this.fReader.skippedSpace()) {
- this.fReader.skipPastSpaces();
- } else {
- this.fErrorHandler.error(116);
- this.fReader.skipToChar('<');
- }
-
- if (this.fDocumentHandler != null && !this.fCalledStartDocument) {
- this.fDocumentHandler.startDocument(-1, -1, -1);
- this.fCalledStartDocument = true;
- }
-
- var1 = false;
- }
- }
-
- private void scanXMLDecl() throws Exception {
- int var1 = -1;
- int var2 = -1;
- int var3 = -1;
- int var4 = this.fReader.skipPastSpaces();
- if (!this.fReader.skippedString(version_string)) {
- this.fErrorHandler.error(146);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- int var5 = this.fReader.currentOffset() - var4;
- this.fReader.skipPastSpaces();
- if (this.fReader.skippedChar('=')) {
- this.fReader.skipPastSpaces();
- if (true) {
- boolean var16;
- if (!(var16 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- this.fErrorHandler.error(16);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- int var7 = this.fReader.currentOffset();
- int var8 = var16 ? 39 : 34;
-
- while(!this.fReader.lookingAtChar((char)var8)) {
- if (!this.fReader.skippedVersionNum()) {
- while(!this.fReader.lookingAtChar((char)var8) && !this.fReader.lookingAtChar('<')) {
- this.fReader.skipOneChar();
- }
-
- if (this.fReader.lookingAtChar('<')) {
- this.fErrorHandler.error(17);
- } else {
- int var9 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
- this.fErrorHandler.error1(151, var9);
- }
-
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
- }
-
- var1 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
- String var23 = this.fStringPool.toString(var1);
- if (!"1.0".equals(var23)) {
- this.fErrorHandler.error(149);
- }
-
- this.fReader.skipAsciiChar();
- if (!this.fReader.skippedSpace()) {
- if (!this.fReader.skippedChar('?')) {
- this.fErrorHandler.error(145);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- if (!this.fReader.skippedChar('>')) {
- this.fErrorHandler.error(145);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- --this.fScannerMarkupDepth;
- if (this.fDocumentHandler != null) {
- this.fDocumentHandler.startDocument(var1, var2, var3);
- this.fCalledStartDocument = true;
- }
-
- return;
- }
-
- int var10;
- int var11;
- label224: {
- var10 = this.fReader.skipPastSpaces();
- if (this.fReader.skippedString(encoding_string)) {
- var11 = this.fReader.currentOffset() - var10;
- this.fReader.skipPastSpaces();
- if (!this.fReader.skippedChar('=')) {
- break label224;
- }
-
- this.fReader.skipPastSpaces();
- if (false) {
- break label224;
- }
-
- if (!(var16 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- this.fErrorHandler.error(16);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- var7 = this.fReader.currentOffset();
- var8 = var16 ? 39 : 34;
- if (!this.fReader.skippedAlpha()) {
- while(!this.fReader.lookingAtChar((char)var8) && !this.fReader.lookingAtChar('<')) {
- this.fReader.skipOneChar();
- }
-
- if (this.fReader.lookingAtChar('<')) {
- this.fErrorHandler.error(17);
- } else {
- int var26 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
- this.fErrorHandler.error1(106, var26);
- }
-
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- while(!this.fReader.lookingAtChar((char)var8)) {
- if (!this.fReader.skippedEncName()) {
- while(!this.fReader.lookingAtChar((char)var8) && !this.fReader.lookingAtChar('<')) {
- this.fReader.skipOneChar();
- }
-
- if (this.fReader.lookingAtChar('<')) {
- this.fErrorHandler.error(17);
- } else {
- int var12 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
- this.fErrorHandler.error1(106, var12);
- }
-
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
- }
-
- var2 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
- this.fReader.skipAsciiChar();
- if (!this.fReader.skippedSpace()) {
- if (!this.fReader.skippedChar('?')) {
- this.fErrorHandler.error(145);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- if (!this.fReader.skippedChar('>')) {
- this.fErrorHandler.error(145);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- --this.fScannerMarkupDepth;
- if (this.fDocumentHandler != null) {
- this.fDocumentHandler.startDocument(var1, var2, var3);
- this.fCalledStartDocument = true;
- }
-
- return;
- }
- }
-
- int var25;
- label244: {
- var11 = this.fReader.skipPastSpaces();
- if (this.fReader.skippedString(standalone_string)) {
- var25 = this.fReader.currentOffset() - var11;
- this.fReader.skipPastSpaces();
- if (!this.fReader.skippedChar('=')) {
- break label244;
- }
-
- this.fReader.skipPastSpaces();
- if (false) {
- break label244;
- }
-
- if (!(var16 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- this.fErrorHandler.error(16);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- var7 = this.fReader.currentOffset();
- var8 = var16 ? 39 : 34;
- boolean var13;
- if (!(var13 = this.fReader.skippedString(yes_string)) && !this.fReader.skippedString(no_string) || !this.fReader.lookingAtChar((char)var8)) {
- while(!this.fReader.lookingAtChar((char)var8) && !this.fReader.lookingAtChar('<')) {
- this.fReader.skipOneChar();
- }
-
- if (this.fReader.lookingAtChar('<')) {
- this.fErrorHandler.error(17);
- } else {
- int var14 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
- this.fErrorHandler.error1(106, var14);
- }
-
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- this.fStandalone = var13;
- var3 = this.fReader.addString(var7, this.fReader.currentOffset() - var7);
- this.fReader.skipAsciiChar();
- }
-
- this.fReader.skipPastSpaces();
- if (!this.fReader.skippedChar('?')) {
- this.fErrorHandler.error(145);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- if (!this.fReader.skippedChar('>')) {
- this.fErrorHandler.error(145);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- --this.fScannerMarkupDepth;
- if (this.fDocumentHandler != null) {
- this.fDocumentHandler.startDocument(var1, var2, var3);
- this.fCalledStartDocument = true;
- }
-
- return;
- }
-
- int var28 = this.fReader.addString(var11, var25);
- this.fErrorHandler.error1(8, var28);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- int var27 = this.fReader.addString(var10, var11);
- this.fErrorHandler.error1(8, var27);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
- }
-
- int var6 = this.fReader.addString(var4, var5);
- this.fErrorHandler.error1(8, var6);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- }
-
- private boolean scanElement(int var1) throws Exception {
- if (this.fStop) {
- throw new StopException(this);
- } else {
- int var5;
- label108: {
- boolean var2 = false;
- int var3 = -1;
- int var4 = -1;
- if (this.fReader.skippedSpace()) {
- while(true) {
- this.fReader.skipPastSpaces();
- if ((var2 = this.fReader.skippedChar('>')) || this.fReader.skippedChar('/')) {
- break;
- }
-
- var5 = this.fReader.scanName('=', -1);
- if (var5 == -1) {
- this.fErrorHandler.error(123);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return false;
- }
-
- this.fReader.skipPastSpaces();
- if (!this.fReader.skippedChar('=')) {
- break label108;
- }
-
- this.fReader.skipPastSpaces();
- if (false) {
- break label108;
- }
-
- int var6 = this.fElementDeclPool.getAttDef(var1, var5);
- boolean var8 = false;
- int var7;
- if (var6 != -1) {
- var7 = this.fElementDeclPool.getAttType(var6);
- var8 = this.fElementDeclPool.getAttDefaultType(var6) == 4;
- } else {
- if (this.fValidationHandler != null) {
- this.fErrorHandler.error2(127, var5, var1);
- }
-
- var7 = 0;
- }
-
- if (!this.scanAttValue(var1, var5, var7, true, var8, false)) {
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return false;
- }
-
- this.fAttr.attName = var5;
- this.fAttr.attType = var7;
- this.fAttr.attValue = this.fAttValueIndex;
- this.fAttr.specified = true;
- int var9 = this.fAttrPool.addAttr(this.fAttr, var3);
- if (var9 != -1) {
- var4 = var9;
- if (var3 == -1) {
- var3 = var9;
- }
- }
- }
- } else if (!(var2 = this.fReader.skippedChar('>')) && !this.fReader.skippedChar('/')) {
- this.fErrorHandler.error(123);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return false;
- }
-
- var5 = this.fElementDeclPool.addElement(var1);
- var3 = this.fElementDeclPool.addDefaultAttributes(var5, this.fAttrPool, var3, var4);
- if (this.fValidationHandler != null) {
- this.fValidationHandler.checkAttributes(var5, var3);
- }
-
- if (this.fDocumentHandler != null) {
- this.fDocumentHandler.startElement(var1, var3);
- } else {
- this.fAttrPool.releaseAttrList(var3);
- }
-
- if (!var2) {
- if (!this.fReader.skippedChar('>')) {
- this.fErrorHandler.error(123);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return false;
- }
-
- --this.fScannerMarkupDepth;
- this.pushElementName(var1);
- if (this.fDocumentHandler != null) {
- this.fDocumentHandler.endElement(var1);
- }
-
- if (this.fValidationHandler != null) {
- int var14 = this.fElementChildCount[this.fElementDepth];
- int var15 = this.fValidationHandler.checkContent(var5, var14, this.fElementChildren[this.fElementDepth]);
- if (var15 != -1) {
- String var16 = this.fElementDeclPool.getContentSpecAsString(var5);
- int var17 = var15 != var14 ? 27 : 164;
- int var10 = this.fStringPool.addString(var16);
- this.fErrorHandler.error2(var17, var1, var10);
- }
- }
-
- if (this.fElementDepth < 0) {
- throw new RuntimeException("Element stack underflow");
- }
-
- --this.fElementDepth;
- return true;
- }
-
- --this.fScannerMarkupDepth;
- this.pushElementName(var1);
- return true;
- }
-
- this.fErrorHandler.error1(8, var5);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return false;
- }
- }
-
- private void scanContent(ScanContentState var1) throws Exception {
- while(true) {
- int var2 = this.fReader.scanContent(var1);
- if ((var2 & 8) != 0) {
- if (this.fValidationHandler != null && (var2 & 16) == 0) {
- this.charDataInContent();
- }
-
- var1.parseTextDecl = false;
- }
-
- switch (var2 & 7) {
- case 1:
- ++this.fScannerMarkupDepth;
- int var3 = this.fReader.scanName('>', -1);
- if (var3 != -1) {
- this.scanElement(var3);
- } else if (this.fReader.skippedChar('/')) {
- if (var1.extParsedEnt && this.fElementDepth == var1.elementDepth) {
- this.fErrorHandler.error(137);
- }
-
- var3 = this.fElementNameStack[this.fElementDepth];
- int var4 = this.fReader.scanName('>', var3);
- if (var4 == -1) {
- this.fErrorHandler.error1(124, var3);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- if (!this.fReader.skippedChar('>')) {
- this.fReader.skipPastSpaces();
- if (!this.fReader.skippedChar('>')) {
- this.fErrorHandler.error1(125, var4);
- }
- }
-
- --this.fScannerMarkupDepth;
- if (this.fDocumentHandler != null) {
- this.fDocumentHandler.endElement(var3);
- }
-
- if (this.fValidationHandler != null) {
- int var5 = this.fElementDeclPool.getElement(var3);
- int var6 = this.fElementChildCount[this.fElementDepth];
- var2 = this.fValidationHandler.checkContent(var5, var6, this.fElementChildren[this.fElementDepth]);
- if (var2 != -1) {
- String var7 = this.fElementDeclPool.getContentSpecAsString(var5);
- int var8 = var2 != var6 ? 27 : 164;
- int var9 = this.fStringPool.addString(var7);
- this.fErrorHandler.error2(var8, var3, var9);
- }
- }
-
- if (this.fElementDepth < 0) {
- throw new RuntimeException("Element stack underflow");
- }
-
- if (--this.fElementDepth < 0 && true) {
- return;
- }
- }
- } else if (this.fReader.skippedChar('!')) {
- if (this.fReader.skippedChar('-')) {
- if (this.fReader.skippedChar('-')) {
- this.scanComment(true);
- } else {
- this.fErrorHandler.error(20);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else if (this.fReader.skippedChar('[')) {
- if (this.fReader.skippedString(cdata_string)) {
- if (this.fReader.skippedChar('[')) {
- var1.inCDSect = true;
- --this.fScannerMarkupDepth;
- } else {
- this.fErrorHandler.error(18);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else {
- this.fErrorHandler.error(18);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else {
- this.fErrorHandler.error(0);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else if (this.fReader.skippedChar('?')) {
- int var13 = this.fReader.scanName(' ', -1);
- if (var13 == -1) {
- this.fErrorHandler.error(102);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else if ("xml".equals(this.fStringPool.toString(var13))) {
- if (this.fReader.skippedSpace()) {
- if (var1.parseTextDecl) {
- this.scanTextDecl();
- } else {
- this.fErrorHandler.error(117);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else {
- this.fErrorHandler.error(107);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else {
- this.scanPI(var13, true);
- }
- } else {
- this.fErrorHandler.error(122);
- }
- break;
- case 2:
- this.referenceInContent(this.fReader.currentOffset());
- break;
- case 3:
- this.fErrorHandler.error(140);
- break;
- case 4:
- try {
- this.fReader.lookingAtValidChar();
- } catch (ArrayIndexOutOfBoundsException var10) {
- if (var1.inCDSect) {
- this.fErrorHandler.error(19);
- }
-
- throw var10;
- }
-
- this.fReader.skipInvalidChar(85);
- }
-
- var1.parseTextDecl = false;
- }
- }
-
- private boolean scanAttValueCDATA(boolean var1, boolean var2) throws Exception {
- boolean var3;
- if (!(var3 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- this.fErrorHandler.error(16);
- return false;
- } else {
- int var4 = var3 ? 39 : 34;
- int var5 = this.fReader.currentOffset();
- int var6 = var5;
- int var7 = var1 ? this.fLiteralData.length() : 0;
- int var8 = 0;
-
- while(true) {
- boolean var9 = false;
- boolean var10 = false;
- if (var8 == 0) {
- while(true) {
- try {
- var9 = this.fReader.skippedChar((char)var4);
- break;
- } catch (ArrayIndexOutOfBoundsException var16) {
- if (var1 && var5 - var6 > 0) {
- this.fReader.append(this.fLiteralData, var6, var5 - var6);
- }
-
- this.popReader();
- --this.fEntityStackDepth;
- var5 = this.fReader.currentOffset();
- var6 = var5;
- }
- }
-
- if (var9) {
- if (var1) {
- int var19 = this.fLiteralData.length() - var7;
- if (var19 == 0) {
- if (var2) {
- this.fAttValueIndex = this.fReader.addSymbol(var6, var5 - var6);
- } else {
- this.fAttValueIndex = this.fReader.addString(var6, var5 - var6);
- }
- } else {
- if (var5 - var6 > 0) {
- this.fReader.append(this.fLiteralData, var6, var5 - var6);
- var19 = this.fLiteralData.length() - var7;
- }
-
- if (var2) {
- this.fAttValueIndex = this.fLiteralData.addSymbol(var7, var19);
- } else {
- this.fAttValueIndex = this.fLiteralData.addString(var7, var19);
- }
- }
- }
-
- return true;
- }
- }
-
- try {
- var9 = this.fReader.skippedChar(' ');
- } catch (ArrayIndexOutOfBoundsException var17) {
- if (var1 && var5 - var6 > 0) {
- this.fReader.append(this.fLiteralData, var6, var5 - var6);
- }
-
- this.popReader();
- --this.fEntityStackDepth;
- --var8;
- var10 = true;
- var5 = this.fReader.currentOffset();
- var6 = var5;
- }
-
- if (!var10) {
- if (var9) {
- var5 = this.fReader.currentOffset();
- } else if (this.fReader.skippedSpace()) {
- if (var1) {
- if (var5 - var6 > 0) {
- this.fReader.append(this.fLiteralData, var6, var5 - var6);
- }
-
- this.fLiteralData.append(' ');
- }
-
- var5 = this.fReader.currentOffset();
- var6 = var5;
- } else if (this.fReader.skippedChar('&')) {
- if (var1 && var5 - var6 > 0) {
- this.fReader.append(this.fLiteralData, var6, var5 - var6);
- }
-
- if (this.fReader.skippedChar('#')) {
- int var11 = this.scanCharRef();
- if (var11 == -1) {
- while(var8-- > 0) {
- this.popReader();
- --this.fEntityStackDepth;
- }
-
- this.fReader.skipPastChar((char)var4);
- return false;
- }
-
- if (var1) {
- if (var11 < 65536) {
- this.fLiteralData.append((char)var11);
- } else {
- this.fLiteralData.append((char)((var11 - 65536 >> 10) + '\ud800'));
- this.fLiteralData.append((char)((var11 - 65536 & 1023) + '\udc00'));
- }
- }
-
- var5 = this.fReader.currentOffset();
- var6 = var5;
- } else {
- int var18 = this.fReader.currentOffset();
- int var12 = this.fReader.skipPastName(';') - var18;
- if (var12 == 0) {
- this.fReader.skipInvalidChar(110);
-
- while(var8-- > 0) {
- this.popReader();
- --this.fEntityStackDepth;
- }
-
- this.fReader.skipPastChar((char)var4);
- return false;
- }
-
- if (!this.fReader.skippedChar(';')) {
- this.fErrorHandler.error(111);
-
- while(var8-- > 0) {
- this.popReader();
- --this.fEntityStackDepth;
- }
-
- this.fReader.skipPastChar((char)var4);
- return false;
- }
-
- int var13 = this.fReader.addSymbol(var18, var12);
- int var14 = this.fEntityPool.lookupEntity(var13);
- if (var14 < 0) {
- this.fErrorHandler.error1(60, var13);
-
- while(var8-- > 0) {
- this.popReader();
- --this.fEntityStackDepth;
- }
-
- this.fReader.skipPastChar((char)var4);
- return false;
- }
-
- if (this.fEntityPool.isExternal(var14)) {
- this.fErrorHandler.error1(67, var13);
-
- while(var8-- > 0) {
- this.popReader();
- --this.fEntityStackDepth;
- }
-
- this.fReader.skipPastChar((char)var4);
- return false;
- }
-
- if (!this.pushEntity((byte)0, var13)) {
- while(var8-- > 0) {
- this.popReader();
- --this.fEntityStackDepth;
- }
-
- this.fReader.skipPastChar((char)var4);
- return false;
- }
-
- StringReader var15 = new StringReader(this.fParserState, false, this.fReader, this.fEntityPool.getEntityValue(var14));
- this.pushReader(var15, (InputSource)null);
- ++var8;
- var5 = this.fReader.currentOffset();
- var6 = var5;
- }
- } else {
- if (this.fReader.skippedChar('<')) {
- this.fErrorHandler.error(17);
-
- while(var8-- > 0) {
- this.popReader();
- --this.fEntityStackDepth;
- }
-
- this.fReader.skipPastChar((char)var4);
- return false;
- }
-
- if (!this.fReader.skippedValidChar()) {
- this.fReader.skipInvalidChar(85);
-
- while(var8-- > 0) {
- this.popReader();
- --this.fEntityStackDepth;
- }
-
- this.fReader.skipPastChar((char)var4);
- return false;
- }
-
- var5 = this.fReader.currentOffset();
- }
- }
- }
- }
- }
-
- private boolean scanNormalizedAttValue(char var1) throws Exception {
- int var2 = 0;
- this.fLiteralData.length();
-
- while(true) {
- try {
- while(this.fReader.skippedChar('&')) {
- if (this.fReader.skippedChar('#')) {
- int var3 = this.scanCharRef();
- if (var3 == -1) {
- this.fReader.skipPastChar(var1);
- return false;
- }
-
- if (var3 < 65536) {
- this.fLiteralData.append((char)var3);
- } else {
- this.fLiteralData.append((char)((var3 - 65536 >> 10) + '\ud800'));
- this.fLiteralData.append((char)((var3 - 65536 & 1023) + '\udc00'));
- }
- } else {
- int var9 = this.fReader.currentOffset();
- int var4 = this.fReader.skipPastName(';') - var9;
- if (var4 == 0) {
- this.fReader.skipInvalidChar(110);
- this.fReader.skipPastChar(var1);
- return false;
- }
-
- if (!this.fReader.skippedChar(';')) {
- this.fErrorHandler.error(111);
- this.fReader.skipPastChar(var1);
- return false;
- }
-
- int var5 = this.fReader.addSymbol(var9, var4);
- int var6 = this.fEntityPool.lookupEntity(var5);
- if (var6 < 0) {
- this.fErrorHandler.error1(60, var5);
- this.fReader.skipPastChar(var1);
- return false;
- }
-
- if (this.fEntityPool.isExternal(var6)) {
- this.fErrorHandler.error1(67, var5);
- this.fReader.skipPastChar(var1);
- return false;
- }
-
- if (!this.pushEntity((byte)0, var5)) {
- this.fReader.skipPastChar(var1);
- return false;
- }
-
- StringReader var7 = new StringReader(this.fParserState, false, this.fReader, this.fEntityPool.getEntityValue(var6));
- this.pushReader(var7, (InputSource)null);
- ++var2;
- }
- }
-
- if (!this.fReader.skippedSpace()) {
- if (this.fReader.lookingAtChar(var1)) {
- if (var2 == 0) {
- this.fReader.skipAsciiChar();
- this.fLiteralData.append(var1);
- return true;
- }
-
- this.fReader.skipInvalidChar(85);
-
- while(var2-- > 0) {
- this.popReader();
- --this.fEntityStackDepth;
- }
-
- this.fReader.skipPastChar(var1);
- return false;
- }
-
- int var10 = this.fReader.currentOffset();
- int var11 = this.fReader.skipOneChar() - var10;
- this.fReader.append(this.fLiteralData, var10, var11);
- } else {
- this.fReader.skipPastSpaces();
- this.fLiteralData.append(' ');
- }
- } catch (ArrayIndexOutOfBoundsException var8) {
- this.popReader();
- --var2;
- --this.fEntityStackDepth;
- }
- }
- }
-
- private boolean scanAttValue(int var1, int var2, int var3, boolean var4, boolean var5, boolean var6) throws Exception {
- if (var3 == 0) {
- return this.scanAttValueCDATA(var4, var5);
- } else {
- boolean var7;
- if (!(var7 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- if (!var6) {
- this.fErrorHandler.error(16);
- }
-
- return false;
- } else {
- int var8 = var7 ? 39 : 34;
- boolean var9 = true;
- boolean var10 = var3 != 3 && var3 != 5 && var3 != 7;
- boolean var11 = var3 != 6 && var3 != 7 && var3 != 9;
- boolean var12 = false;
- boolean var13 = false;
- int var14 = this.fReader.skipPastSpaces();
- int var15 = this.fLiteralData.length();
-
- while(true) {
- int var16 = this.fReader.currentOffset();
- int var17 = (var11 ? this.fReader.skipPastName((char)var8) : this.fReader.skipPastNmtoken((char)var8)) - var16;
- if (var17 == 0) {
- if (var12) {
- this.fReader.skipInvalidChar(85);
- this.popReader();
- return false;
- }
-
- if (this.fReader.skippedChar((char)var8)) {
- if (!var6) {
- this.fErrorHandler.error1(142, var2);
- }
-
- return false;
- }
-
- if (var16 - var14 > 0) {
- this.fReader.append(this.fLiteralData, var14, var16 - var14);
- }
-
- var14 = -1;
- int var18 = this.fLiteralData.length();
- if (!this.scanNormalizedAttValue((char)var8)) {
- return false;
- }
-
- int var19 = this.fLiteralData.addString(var18, this.fLiteralData.length() - var18);
- StringReader var20 = new StringReader(this.fParserState, false, this.fReader, var19);
- this.pushReader(var20, (InputSource)null);
- var12 = true;
- this.fLiteralData.setLength(var18);
- var16 = this.fReader.skipPastSpaces();
- if (this.fReader.skippedChar((char)var8)) {
- if (var9) {
- if (!var6) {
- this.fErrorHandler.error1(142, var2);
- }
-
- this.popReader();
- return false;
- }
-
- if (var5) {
- this.fAttValueIndex = this.fLiteralData.addSymbol(var15, var18 - var15);
- } else {
- this.fAttValueIndex = this.fLiteralData.addString(var15, var18 - var15);
- }
-
- this.popReader();
- return true;
- }
-
- var17 = (var11 ? this.fReader.skipPastName((char)var8) : this.fReader.skipPastNmtoken((char)var8)) - var16;
- if (var17 == 0) {
- this.fReader.skipInvalidChar(85);
- this.popReader();
- return false;
- }
- }
-
- boolean var31;
- int var32;
- if (var12) {
- int var33 = this.fLiteralData.length();
- this.fReader.append(this.fLiteralData, var16, var17);
- int var21 = this.fLiteralData.length();
- boolean var22 = this.fReader.skippedSpace();
- if (var22) {
- this.fReader.skipPastSpaces();
- }
-
- var31 = this.fReader.skippedChar((char)var8);
- if (var31) {
- var32 = this.fLiteralData.addSymbol(var33, var21 - var33);
- if (var9) {
- this.fAttValueIndex = var32;
- } else if (var5) {
- this.fAttValueIndex = this.fLiteralData.addSymbol(var15, var21 - var15);
- } else {
- this.fAttValueIndex = this.fLiteralData.addString(var15, var21 - var15);
- }
-
- this.popReader();
- } else {
- if (!var22) {
- this.fReader.skipInvalidChar(85);
- this.popReader();
- return false;
- }
-
- if (var10) {
- this.fReader.skipInvalidChar(85);
- this.popReader();
- return false;
- }
-
- var32 = this.fLiteralData.addSymbol(var33, var21 - var33);
- this.fLiteralData.append(' ');
- var16 = this.fReader.currentOffset();
- }
- } else {
- boolean var34 = false;
- boolean var36 = this.fReader.skippedChar(' ');
- if (this.fReader.skippedSpace()) {
- this.fReader.skipPastSpaces();
- var36 = true;
- var34 = true;
- }
-
- var31 = this.fReader.skippedChar((char)var8);
- if (var31) {
- if (var13) {
- int var39 = this.fLiteralData.length();
- this.fReader.append(this.fLiteralData, var16, var17);
- int var23 = this.fLiteralData.length();
- var32 = this.fLiteralData.addSymbol(var39, var23 - var39);
- if (var5) {
- this.fAttValueIndex = this.fLiteralData.addSymbol(var15, var23 - var15);
- } else {
- this.fAttValueIndex = this.fLiteralData.addString(var15, var23 - var15);
- }
- } else {
- var32 = this.fReader.addSymbol(var16, var17);
- if (var9) {
- this.fAttValueIndex = var32;
- } else if (var5) {
- this.fAttValueIndex = this.fReader.addSymbol(var14, var16 + var17 - var14);
- } else {
- this.fAttValueIndex = this.fReader.addString(var14, var16 + var17 - var14);
- }
- }
- } else if (var36) {
- if (var10 && !var31) {
- this.fReader.skipInvalidChar(85);
- this.fReader.skipPastChar((char)var8);
- return false;
- }
-
- if (var13) {
- int var40 = this.fLiteralData.length();
- this.fReader.append(this.fLiteralData, var16, var17);
- int var45 = this.fLiteralData.length();
- var32 = this.fLiteralData.addSymbol(var40, var45 - var40);
- this.fLiteralData.append(' ');
- } else if (var34) {
- if (var16 - var14 > 0) {
- this.fReader.append(this.fLiteralData, var14, var16 - var14);
- }
-
- var14 = -1;
- int var41 = this.fLiteralData.length();
- this.fReader.append(this.fLiteralData, var16, var17);
- int var46 = this.fLiteralData.length();
- var32 = this.fLiteralData.addSymbol(var41, var46 - var41);
- this.fLiteralData.append(' ');
- var13 = true;
- } else {
- var32 = this.fReader.addSymbol(var16, var17);
- }
- } else {
- if (var16 - var14 > 0) {
- this.fReader.append(this.fLiteralData, var14, var16 - var14);
- }
-
- var14 = -1;
- int var42 = this.fLiteralData.length();
- this.fReader.append(this.fLiteralData, var16, var17);
- if (!this.scanNormalizedAttValue((char)var8)) {
- return false;
- }
-
- int var47 = this.fLiteralData.addString(var42, this.fLiteralData.length() - var42);
- StringReader var24 = new StringReader(this.fParserState, false, this.fReader, var47);
- this.pushReader(var24, (InputSource)null);
- var12 = true;
- this.fLiteralData.setLength(var42);
- var16 = this.fReader.currentOffset();
- var17 = (var11 ? this.fReader.skipPastName((char)var8) : this.fReader.skipPastNmtoken((char)var8)) - var16;
- int var25 = this.fLiteralData.length();
- this.fReader.append(this.fLiteralData, var16, var17);
- int var26 = this.fLiteralData.length();
- var36 = this.fReader.skippedSpace();
- if (var36) {
- this.fReader.skipPastSpaces();
- }
-
- var31 = this.fReader.skippedChar((char)var8);
- if (var31) {
- var32 = this.fLiteralData.addSymbol(var25, var26 - var25);
- if (var9) {
- this.fAttValueIndex = var32;
- } else if (var5) {
- this.fAttValueIndex = this.fLiteralData.addSymbol(var15, var26 - var15);
- } else {
- this.fAttValueIndex = this.fLiteralData.addString(var15, var26 - var15);
- }
-
- this.popReader();
- } else {
- if (!var36) {
- this.fReader.skipInvalidChar(85);
- this.popReader();
- return false;
- }
-
- if (var10) {
- this.fReader.skipInvalidChar(85);
- this.popReader();
- return false;
- }
-
- var32 = this.fLiteralData.addSymbol(var25, var26 - var25);
- this.fLiteralData.append(' ');
- var16 = this.fReader.currentOffset();
- }
- }
- }
-
- switch (var3) {
- case 1:
- if (this.fValidationHandler != null && !this.fElementDeclPool.addId(var32, var1)) {
- this.fErrorHandler.error1(129, var32);
- }
-
- return true;
- case 2:
- case 3:
- if (var1 != -1 && this.fValidationHandler != null) {
- this.fElementDeclPool.addIdRef(var32, var1);
- }
-
- if (var31) {
- return true;
- }
- break;
- case 4:
- case 5:
- int var35 = this.fEntityPool.lookupEntity(var32);
- if (this.fValidationHandler != null && var35 == -1 || !this.fEntityPool.isUnparsed(var35)) {
- this.fErrorHandler.error1(131, var32);
- if (!var31) {
- this.fReader.skipPastChar((char)var8);
- }
- }
-
- if (var31) {
- return true;
- }
- break;
- case 6:
- case 7:
- if (var31) {
- return true;
- }
- break;
- case 8:
- case 9:
- int var38;
- if (var1 == -1) {
- var38 = this.fAttDef.enumeration;
- } else {
- int var43 = this.fElementDeclPool.getAttDef(var1, var2);
- var38 = this.fElementDeclPool.getEnumeration(var43);
- }
-
- if (this.fValidationHandler != null && !this.fStringPool.stringInList(var38, var32)) {
- int[] var44 = this.fStringPool.stringsInList(var38);
- StringBuffer var48 = new StringBuffer();
- int var49 = var44.length;
-
- for(int var50 = 0; var50 < var49; ++var50) {
- var48.append(this.fStringPool.toString(var44[var50]));
- if (var50 < var49 - 1) {
- var48.append(",");
- }
- }
-
- int var51 = this.fStringPool.addSymbol(var48.toString());
- this.fErrorHandler.error2(161, var32, var51);
- }
-
- return true;
- }
-
- var9 = false;
- }
- }
- }
- }
-
- private int referenceInEntityValue(int var1, boolean var2) throws Exception {
- if (this.fReader.skippedChar('#')) {
- int var5 = this.scanCharRef();
- if (var5 == -1) {
- return this.fReader.currentOffset();
- } else {
- if (var2) {
- if (var5 < 65536) {
- this.fLiteralData.append((char)var5);
- } else {
- this.fLiteralData.append((char)((var5 - 65536 >> 10) + '\ud800'));
- this.fLiteralData.append((char)((var5 - 65536 & 1023) + '\udc00'));
- }
- }
-
- return this.fReader.currentOffset();
- }
- } else {
- int var3 = this.fReader.currentOffset();
- int var4 = this.fReader.skipPastName(';') - var3;
- if (var4 == 0) {
- this.fReader.skipInvalidChar(110);
- return this.fReader.currentOffset();
- } else if (!this.fReader.skippedChar(';')) {
- this.fErrorHandler.error(111);
- return this.fReader.currentOffset();
- } else {
- if (var2) {
- this.fReader.append(this.fLiteralData, var1, this.fReader.currentOffset() - var1);
- }
-
- return this.fReader.currentOffset();
- }
- }
- }
-
- private boolean referenceInContent(int var1) throws Exception {
- if (this.fReader.skippedChar('#')) {
- int var14 = this.scanCharRef();
- if (var14 == -1) {
- return false;
- } else {
- if (this.fDocumentHandler != null) {
- if (this.fCharRefData == null) {
- this.fCharRefData = new char[2];
- }
-
- int var15 = var14 < 65536 ? 1 : 2;
- if (var15 == 1) {
- this.fCharRefData[0] = (char)var14;
- } else {
- this.fCharRefData[0] = (char)((var14 - 65536 >> 10) + '\ud800');
- this.fCharRefData[1] = (char)((var14 - 65536 & 1023) + '\udc00');
- }
-
- if (!this.fDocumentHandler.sendCharDataAsCharArray()) {
- int var16 = this.fStringPool.addString(new String(this.fCharRefData, 0, var15));
- this.fDocumentHandler.characters(var16, false);
- } else {
- this.fDocumentHandler.characters(this.fCharRefData, 0, var15, false);
- }
- }
-
- return true;
- }
- } else {
- int var2 = this.fReader.currentOffset();
- int var3 = this.fReader.skipPastName(';') - var2;
- if (var3 == 0) {
- this.fReader.skipInvalidChar(110);
- return false;
- } else if (!this.fReader.skippedChar(';')) {
- this.fErrorHandler.error(111);
- return false;
- } else {
- int var4 = this.fReader.addSymbol(var2, var3);
- int var5 = this.fEntityPool.lookupEntity(var4);
- if (var5 < 0) {
- this.fErrorHandler.error1(60, var4);
- return false;
- } else if (this.fEntityPool.isUnparsed(var5)) {
- this.fErrorHandler.error1(62, var4);
- return false;
- } else if (!this.pushEntity((byte)0, var4)) {
- return false;
- } else {
- if (this.fDocumentHandler != null) {
- this.fDocumentHandler.startEntityReference(var5);
- }
-
- Object var6 = null;
- InputSource var7 = null;
- if (this.fEntityPool.isExternal(var5)) {
- int var8 = this.fEntityPool.getPublicId(var5);
- int var9 = this.fEntityPool.getSystemId(var5);
- var9 = this.fEntityHandler.expandSystemId(var9);
- var7 = this.fEntityHandler.resolveEntity(var8, var9);
- if (var7 == null) {
- var7 = new InputSource(this.fStringPool.toString(var9));
- if (var8 != -1) {
- var7.setPublicId(this.fStringPool.toString(var8));
- }
- }
-
- var6 = this.fEntityHandler.createReader(var7, false);
- this.fEntityHandler.startInputSource(var7);
- } else {
- var6 = new StringReader(this.fParserState, false, this.fReader, this.fEntityPool.getEntityValue(var5));
- }
-
- int var18 = this.pushReader((XMLReader)var6, var7);
- int var20 = this.setActiveReaderLimit(var18);
-
- try {
- ScanContentState var10 = new ScanContentState();
- var10.inCDSect = false;
- var10.extParsedEnt = true;
- var10.parseTextDecl = this.fReader.lookingAtChar('<');
- var10.elementDepth = this.fElementDepth;
- this.scanContent(var10);
- } catch (ArrayIndexOutOfBoundsException var11) {
- } catch (StopException var12) {
- throw var12;
- } catch (Exception var13) {
- throw var13;
- }
-
- this.setActiveReaderLimit(var20);
- this.popReader();
- if (this.fDocumentHandler != null) {
- this.fDocumentHandler.endEntityReference(var5);
- }
-
- --this.fEntityStackDepth;
- return true;
- }
- }
- }
- }
-
- private int scanCharRef() throws Exception {
- boolean var1 = this.fReader.skippedChar('x');
- int var2 = this.fReader.currentOffset();
- int var3 = 0;
- int var4 = 0;
- if (var1) {
- int var5 = this.fReader.skipHexDigit();
- if (var5 < 0) {
- if (this.fReader.skippedChar(';')) {
- this.fErrorHandler.error(112);
- } else {
- this.fReader.skipInvalidChar(110);
- }
-
- return -1;
- }
-
- var4 = var5;
-
- while(true) {
- var5 = this.fReader.skipHexDigit();
- if (var5 < 0) {
- break;
- }
-
- var4 = (var4 << 4) + var5;
- if (var4 > 1114111) {
- this.fReader.skipToChar(';');
- break;
- }
- }
- } else {
- int var10 = this.fReader.skipDecimalDigit();
- if (var10 < 0) {
- if (this.fReader.skippedChar(';')) {
- this.fErrorHandler.error(112);
- } else {
- this.fReader.skipInvalidChar(110);
- }
-
- return -1;
- }
-
- var4 = var10;
-
- while(true) {
- var10 = this.fReader.skipDecimalDigit();
- if (var10 < 0) {
- break;
- }
-
- var4 = var4 * 10 + var10;
- if (var4 > 1114111) {
- this.fReader.skipToChar(';');
- break;
- }
- }
- }
-
- var3 = this.fReader.currentOffset() - var2;
- if (!this.fReader.skippedChar(';')) {
- this.fErrorHandler.error(111);
- return -1;
- } else {
- if (var4 < 32) {
- if (var4 == 9 || var4 == 10 || var4 == 13) {
- return var4;
- }
- } else if (var4 <= 55295 || var4 >= 57344 && (var4 <= 65533 || var4 >= 65536 && var4 <= 1114111)) {
- return var4;
- }
-
- int var12 = var1 ? 113 : 114;
- int var6 = this.fReader.addString(var2, var3);
- this.fErrorHandler.error1(var12, var6);
- return -1;
- }
- }
-
- private void scanMisc() throws Exception {
- while(true) {
- if (this.fReader.skippedChar('<')) {
- ++this.fScannerMarkupDepth;
- if (this.fReader.skippedChar('?')) {
- int var1 = this.fReader.scanName(' ', -1);
- if (var1 == -1) {
- this.fErrorHandler.error(102);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else if ("xml".equals(this.fStringPool.toString(var1))) {
- if (this.fReader.skippedSpace()) {
- this.fErrorHandler.error(117);
- } else {
- this.fErrorHandler.error(107);
- }
-
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- this.scanPI(var1, true);
- }
- } else if (this.fReader.skippedChar('!')) {
- if (this.fReader.skippedChar('-')) {
- if (this.fReader.skippedChar('-')) {
- this.scanComment(true);
- } else {
- this.fErrorHandler.error(20);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else {
- this.fErrorHandler.error(116);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else {
- this.fErrorHandler.error(116);
- this.fReader.skipToChar('<');
- --this.fScannerMarkupDepth;
- }
- } else if (this.fReader.skippedSpace()) {
- this.fReader.skipPastSpaces();
- } else if (!this.fReader.lookingAtValidChar()) {
- this.fReader.skipInvalidChar(85);
- } else {
- this.fErrorHandler.error(116);
- this.fReader.skipToChar('<');
- }
- }
- }
-
- private void scanPI(int var1, boolean var2) throws Exception {
- String var3 = this.fStringPool.toString(var1);
- if (var3.length() != 3 || var3.charAt(0) != 'X' && var3.charAt(0) != 'x' || var3.charAt(1) != 'M' && var3.charAt(1) != 'm' || var3.charAt(2) != 'L' && var3.charAt(2) != 'l') {
- if (!this.fReader.skippedSpace()) {
- if (!this.fReader.skippedChar('?')) {
- this.fErrorHandler.error(105);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else if (!this.fReader.skippedChar('>')) {
- this.fErrorHandler.error(105);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- --this.fScannerMarkupDepth;
- if (var2 && this.fDocumentHandler != null) {
- this.fDocumentHandler.processingInstruction(var1, -1);
- }
-
- }
- } else {
- int var4 = this.fReader.skipPastSpaces();
-
- try {
- do {
- while(this.fReader.lookingAtChar('?')) {
- int var5 = this.fReader.currentOffset();
- this.fReader.skipAsciiChar();
- if (this.fReader.skippedChar('>')) {
- --this.fScannerMarkupDepth;
- if (var2 && this.fDocumentHandler != null) {
- int var6 = -1;
- if (var5 != var4) {
- var6 = this.fReader.addString(var4, var5 - var4);
- }
-
- this.fDocumentHandler.processingInstruction(var1, var6);
- }
-
- return;
- }
- }
- } while(this.fReader.skippedValidChar());
-
- this.fReader.skipInvalidChar(85);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } catch (ArrayIndexOutOfBoundsException var7) {
- if ((this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1]) == 0) {
- this.fErrorHandler.error(105);
- throw var7;
- }
- }
- }
- } else {
- this.fErrorHandler.error(107);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- }
-
- private void scanDoctypeDecl() throws Exception {
- if (!this.fReader.skippedSpace()) {
- this.fErrorHandler.error(115);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- this.fReader.skipPastSpaces();
- int var1 = this.fReader.scanName(' ', -1);
- if (var1 == -1) {
- this.fErrorHandler.error(40);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- int var2 = this.fElementDeclPool.addElement(var1);
- this.fElementDeclPool.setRootElement(var2);
- if (this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.doctypeDecl(var1);
- }
-
- boolean var4 = false;
- int var5 = -1;
- int var6 = -1;
- boolean var3;
- if (this.fReader.skippedSpace()) {
- this.fReader.skipPastSpaces();
- if (!(var3 = this.fReader.skippedChar('[')) && !this.fReader.lookingAtChar('>')) {
- var4 = true;
- if (!this.scanExternalIDorPublicID(var4, false)) {
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- var5 = this.fPubidLiteral;
- var6 = this.fSystemLiteral;
- this.fReader.skipPastSpaces();
- var3 = this.fReader.skippedChar('[');
- }
- } else {
- var3 = this.fReader.skippedChar('[');
- }
-
- if (var3) {
- if (!this.scanIntSubsetDecl()) {
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- this.fReader.skipPastSpaces();
- }
-
- if (!this.fReader.skippedChar('>')) {
- this.fErrorHandler.error(125);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- --this.fScannerMarkupDepth;
- if (var4) {
- if (this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.startExternalSubset(var5, var6);
- }
-
- int var7 = this.fScannerState;
- this.fScannerState = 3;
- var6 = this.fEntityHandler.expandSystemId(var6);
- InputSource var8 = this.fEntityHandler.resolveEntity(var5, var6);
- if (var8 == null) {
- var8 = new InputSource(this.fStringPool.toString(var6));
- if (var5 != -1) {
- var8.setPublicId(this.fStringPool.toString(var5));
- }
- }
-
- XMLReader var9 = this.fEntityHandler.createReader(var8, false);
- this.fEntityHandler.startInputSource(var8);
- int var10 = this.pushReader(var9, var8);
- int var11 = this.setActiveReaderLimit(var10);
-
- try {
- this.scanExtSubsetDecl(false);
- } catch (ArrayIndexOutOfBoundsException var13) {
- } catch (StopException var14) {
- throw var14;
- } catch (Exception var15) {
- throw var15;
- }
-
- this.setActiveReaderLimit(var11);
- this.popReader();
- this.fScannerState = var7;
- if (this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.endExternalSubset();
- }
- }
-
- if (this.fParserState.getValidationHandler() != null) {
- this.fElementDeclPool.checkDeclaredElements();
- }
-
- }
- }
- }
- }
-
- private boolean scanIntSubsetDecl() throws Exception {
- if (this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.startInternalSubset();
- }
-
- boolean var1 = true;
- int var2 = this.fScannerState;
- this.fScannerState = 2;
-
- while(!this.fReader.skippedChar(']')) {
- if (this.fReader.skippedChar('<')) {
- this.scanMarkupDecl(false);
- } else if (this.fReader.skippedSpace()) {
- this.fReader.skipPastSpaces();
- } else if (this.fReader.skippedChar('%')) {
- this.scanPEReference();
- } else {
- if (this.fReader.lookingAtChar('>')) {
- this.fReader.skipInvalidChar(43);
- return false;
- }
-
- this.fReader.lookingAtValidChar();
- this.fReader.skipInvalidChar(43);
- var1 = false;
-
- while(true) {
- this.fReader.skipOneChar();
- if (this.fReader.lookingAtChar('%') || this.fReader.lookingAtChar('<') || this.fReader.lookingAtSpace() || this.fReader.lookingAtChar(']')) {
- break;
- }
- }
- }
- }
-
- this.fScannerState = var2;
- if (this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.endInternalSubset();
- }
-
- return var1;
- }
-
- private void scanTextDecl() throws Exception {
- int var3;
- int var5;
- label137: {
- var3 = this.fReader.skipPastSpaces();
- int var4;
- if (this.fReader.skippedString(version_string)) {
- var5 = this.fReader.currentOffset() - var3;
- this.fReader.skipPastSpaces();
- if (!this.fReader.skippedChar('=')) {
- break label137;
- }
-
- this.fReader.skipPastSpaces();
- if (false) {
- break label137;
- }
-
- boolean var1;
- if (!(var1 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- this.fErrorHandler.error(16);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- int var6 = this.fReader.currentOffset();
- int var2 = var1 ? 39 : 34;
-
- while(!this.fReader.lookingAtChar((char)var2)) {
- if (!this.fReader.skippedVersionNum()) {
- while(!this.fReader.lookingAtChar((char)var2) && !this.fReader.lookingAtChar('<')) {
- this.fReader.skipOneChar();
- }
-
- if (this.fReader.lookingAtChar('<')) {
- this.fErrorHandler.error(17);
- } else {
- int var7 = this.fReader.addString(var6, this.fReader.currentOffset() - var6);
- this.fErrorHandler.error1(151, var7);
- }
-
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
- }
-
- String var14 = this.fStringPool.orphanString(this.fReader.addString(var6, this.fReader.currentOffset() - var6));
- if (!"1.0".equals(var14)) {
- this.fErrorHandler.error(149);
- }
-
- this.fReader.skipAsciiChar();
- if (!this.fReader.skippedSpace()) {
- this.fErrorHandler.error(115);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- var4 = this.fReader.skipPastSpaces();
- } else {
- var4 = var3;
- }
-
- if (!this.fReader.skippedString(encoding_string)) {
- this.fErrorHandler.error(109);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- var5 = this.fReader.currentOffset() - var4;
- this.fReader.skipPastSpaces();
- if (this.fReader.skippedChar('=')) {
- this.fReader.skipPastSpaces();
- if (true) {
- boolean var8;
- if (!(var8 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- this.fErrorHandler.error(16);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- int var13 = this.fReader.currentOffset();
- int var9 = var8 ? 39 : 34;
- if (!this.fReader.skippedAlpha()) {
- while(!this.fReader.lookingAtChar((char)var9) && !this.fReader.lookingAtChar('<')) {
- this.fReader.skipOneChar();
- }
-
- if (this.fReader.lookingAtChar('<')) {
- this.fErrorHandler.error(17);
- } else {
- int var16 = this.fReader.addString(var13, this.fReader.currentOffset() - var13);
- this.fErrorHandler.error1(106, var16);
- }
-
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- while(!this.fReader.lookingAtChar((char)var9)) {
- if (!this.fReader.skippedEncName()) {
- while(!this.fReader.lookingAtChar((char)var9) && !this.fReader.lookingAtChar('<')) {
- this.fReader.skipOneChar();
- }
-
- if (this.fReader.lookingAtChar('<')) {
- this.fErrorHandler.error(17);
- } else {
- int var15 = this.fReader.addString(var13, this.fReader.currentOffset() - var13);
- this.fErrorHandler.error1(106, var15);
- }
-
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
- }
-
- this.fReader.skipAsciiChar();
- this.fReader.skipPastSpaces();
- if (!this.fReader.skippedChar('?')) {
- this.fErrorHandler.error(105);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- if (!this.fReader.skippedChar('>')) {
- this.fErrorHandler.error(105);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- --this.fScannerMarkupDepth;
- return;
- }
- }
-
- int var12 = this.fReader.addString(var4, var5);
- this.fErrorHandler.error1(8, var12);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- int var11 = this.fReader.addString(var3, var5);
- this.fErrorHandler.error1(8, var11);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
-
- private void scanExtSubsetDecl(boolean var1) throws Exception {
- boolean var2 = !var1;
-
- try {
- while(true) {
- if (this.checkSkippedChar('<', false)) {
- this.scanMarkupDecl(var2);
- } else if (this.checkSkippedSpace()) {
- this.checkSkipPastSpaces();
- } else if (this.checkSkippedChar('%', false)) {
- this.scanPEReference();
- } else {
- if (var1 && this.checkSkippedChar(']', false)) {
- if (!this.checkSkippedChar(']', false)) {
- this.fErrorHandler.error(24);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- if (!this.checkSkippedChar('>', false)) {
- this.fErrorHandler.error(24);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- --this.fScannerMarkupDepth;
- return;
- }
-
- if (!this.fReader.lookingAtValidChar()) {
- this.fReader.skipInvalidChar(85);
- } else {
- this.fErrorHandler.error(116);
- }
-
- do {
- this.fReader.skipOneChar();
- } while(!this.fReader.lookingAtChar('%') && !this.fReader.lookingAtChar('<') && (!var1 || !this.fReader.lookingAtChar(']')));
- }
-
- var2 = false;
- }
- } catch (ArrayIndexOutOfBoundsException var4) {
- if (var1) {
- this.fErrorHandler.error(24);
- }
-
- throw var4;
- }
- }
-
- private boolean scanExternalID(boolean var1) throws Exception {
- return this.scanExternalIDorPublicID(var1, false);
- }
-
- private boolean scanExternalIDorPublicID(boolean var1) throws Exception {
- return this.scanExternalIDorPublicID(var1, true);
- }
-
- private boolean scanExternalIDorPublicID(boolean var1, boolean var2) throws Exception {
- this.fSystemLiteral = -1;
- this.fPubidLiteral = -1;
- int var3 = this.fReader.currentOffset();
- if (this.fReader.skippedString(system_string)) {
- if (!this.fReader.skippedSpace()) {
- this.fErrorHandler.error(115);
- return false;
- } else {
- this.fReader.skipPastSpaces();
- return this.scanSystemLiteral(var1);
- }
- } else if (this.fReader.skippedString(public_string)) {
- if (!this.fReader.skippedSpace()) {
- this.fErrorHandler.error(115);
- return false;
- } else {
- this.fReader.skipPastSpaces();
- if (!this.scanPubidLiteral(var1)) {
- return false;
- } else {
- if (var2) {
- if (!this.fReader.skippedSpace()) {
- return true;
- }
-
- this.fReader.skipPastSpaces();
- if (this.fReader.lookingAtChar('>')) {
- return true;
- }
- } else {
- if (!this.fReader.skippedSpace()) {
- this.fErrorHandler.error(115);
- return false;
- }
-
- this.fReader.skipPastSpaces();
- }
-
- return this.scanSystemLiteral(var1);
- }
- }
- } else {
- int var4 = this.fReader.skipPastNmtoken(' ') - var3;
- int var5 = this.fReader.addString(var3, var4);
- this.fErrorHandler.error1(41, var5);
- return false;
- }
- }
-
- private boolean scanSystemLiteral(boolean var1) throws Exception {
- boolean var2;
- if (!(var2 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- this.fErrorHandler.error(81);
- return false;
- } else {
- int var3 = this.fReader.currentOffset();
- int var4 = var2 ? 39 : 34;
-
- while(!this.fReader.lookingAtChar((char)var4)) {
- if (!this.fReader.skippedValidChar()) {
- this.fReader.skipInvalidChar(82);
- this.fReader.skipPastChar((char)var4);
- return false;
- }
- }
-
- if (var1) {
- this.fSystemLiteral = this.fReader.addString(var3, this.fReader.currentOffset() - var3);
- }
-
- this.fReader.skipAsciiChar();
- return true;
- }
- }
-
- private boolean scanPubidLiteral(boolean var1) throws Exception {
- boolean var2;
- if (!(var2 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- this.fErrorHandler.error(79);
- return false;
- } else {
- int var3 = var2 ? 39 : 34;
- int var4 = this.fReader.skipPastSpaces();
- int var5 = var1 ? this.fLiteralData.length() : 0;
- int var6 = var4;
-
- while(true) {
- if (this.fReader.skippedChar((char)var3)) {
- if (var1 && var4 - var6 > 0) {
- this.fReader.append(this.fLiteralData, var6, var4 - var6);
- }
- break;
- }
-
- if (this.fReader.skippedSpace()) {
- if (var1 && var4 - var6 > 0) {
- this.fReader.append(this.fLiteralData, var6, var4 - var6);
- }
-
- var4 = this.fReader.skipPastSpaces();
- var6 = var4;
- if (this.fReader.skippedChar((char)var3)) {
- break;
- }
-
- if (var1) {
- this.fLiteralData.append(' ');
- }
- }
-
- if (!this.fReader.skippedPubidChar()) {
- this.fReader.skipInvalidChar(80);
- this.fReader.skipPastChar((char)var3);
- return false;
- }
-
- var4 = this.fReader.currentOffset();
- }
-
- if (var1) {
- int var7 = this.fLiteralData.length() - var5;
- this.fPubidLiteral = this.fLiteralData.addString(var5, var7);
- }
-
- return true;
- }
- }
-
- private void scanPEReference() throws Exception {
- int var1 = this.fReader.currentOffset();
- int var2 = this.fReader.skipPastName(';') - var1;
- if (var2 == 0) {
- this.fErrorHandler.error(92);
- } else if (!this.fReader.skippedChar(';')) {
- int var13 = this.fReader.addString(var1, var2);
- this.fErrorHandler.error1(93, var13);
- } else {
- int var3 = this.fReader.addSymbol(var1, var2);
- int var4 = this.fParameterEntityPool == null ? -1 : this.fParameterEntityPool.lookupEntity(var3);
- if (var4 < 0) {
- this.fErrorHandler.error1(94, var3);
- } else {
- this.fDocumentTypeHandler.parameterEntityDecl(var4);
- if (this.pushEntity((byte)1, var3)) {
- Object var5 = null;
- InputSource var6 = null;
- if (this.fParameterEntityPool.isExternal(var4)) {
- int var7 = this.fParameterEntityPool.getPublicId(var4);
- int var8 = this.fParameterEntityPool.getSystemId(var4);
- var8 = this.fEntityHandler.expandSystemId(var8);
- var6 = this.fEntityHandler.resolveEntity(var7, var8);
- if (var6 == null) {
- var6 = new InputSource(this.fStringPool.toString(var8));
- if (var7 != -1) {
- var6.setPublicId(this.fStringPool.toString(var7));
- }
- }
-
- var5 = this.fEntityHandler.createReader(var6, false);
- this.fEntityHandler.startInputSource(var6);
- } else {
- var5 = new StringReader(this.fParserState, true, this.fReader, this.fParameterEntityPool.getEntityValue(var4));
- }
-
- int var15 = this.pushReader((XMLReader)var5, var6);
- int var17 = this.setActiveReaderLimit(var15);
-
- try {
- this.scanExtSubsetDecl(false);
- } catch (ArrayIndexOutOfBoundsException var10) {
- } catch (StopException var11) {
- throw var11;
- } catch (Exception var12) {
- throw var12;
- }
-
- this.setActiveReaderLimit(var17);
- this.popReader();
- --this.fEntityStackDepth;
- }
- }
- }
- }
-
- private boolean copyPEReference() throws Exception {
- int var1 = this.fReader.currentOffset();
- int var2 = this.fReader.skipPastName(';') - var1;
- if (var2 == 0) {
- this.fErrorHandler.error(92);
- return false;
- } else if (!this.fReader.skippedChar(';')) {
- int var17 = this.fReader.addString(var1, var2);
- this.fErrorHandler.error1(93, var17);
- return false;
- } else {
- int var3 = this.fReader.addSymbol(var1, var2);
- int var4 = this.fParameterEntityPool == null ? -1 : this.fParameterEntityPool.lookupEntity(var3);
- if (var4 < 0) {
- this.fErrorHandler.error1(94, var3);
- return false;
- } else {
- this.fDocumentTypeHandler.parameterEntityDecl(var4);
- if (!this.fParameterEntityPool.isExternal(var4)) {
- this.fLiteralData.append(this.fStringPool.toString(this.fParameterEntityPool.getEntityValue(var4)));
- return true;
- } else if (!this.pushEntity((byte)1, var3)) {
- return false;
- } else {
- int var5 = this.fParameterEntityPool.getPublicId(var4);
- int var6 = this.fParameterEntityPool.getSystemId(var4);
- var6 = this.fEntityHandler.expandSystemId(var6);
- InputSource var7 = this.fEntityHandler.resolveEntity(var5, var6);
- if (var7 == null) {
- var7 = new InputSource(this.fStringPool.toString(var6));
- if (var5 != -1) {
- var7.setPublicId(this.fStringPool.toString(var5));
- }
- }
-
- XMLReader var8 = this.fEntityHandler.createReader(var7, false);
- this.fEntityHandler.startInputSource(var7);
- int var9 = this.pushReader(var8, var7);
- int var10 = this.setActiveReaderLimit(var9);
- int var11 = this.fReader.currentOffset();
- boolean var12 = true;
-
- try {
- while(this.fReader.skippedValidChar()) {
- }
-
- this.fReader.skipInvalidChar(63);
- var12 = false;
- } catch (ArrayIndexOutOfBoundsException var14) {
- } catch (StopException var15) {
- throw var15;
- } catch (Exception var16) {
- throw var16;
- }
-
- if (var12) {
- this.fReader.append(this.fLiteralData, var11, this.fReader.currentOffset() - var11);
- }
-
- this.setActiveReaderLimit(var10);
- this.popReader();
- --this.fEntityStackDepth;
- return var12;
- }
- }
- }
- }
-
- private void expandPEReference() throws Exception {
- int var1 = this.fReader.currentOffset();
- int var2 = this.fReader.skipPastName(';') - var1;
- if (var2 == 0) {
- this.fErrorHandler.error(92);
- }
-
- if (!this.fReader.skippedChar(';')) {
- int var3 = this.fReader.addString(var1, var2);
- this.fErrorHandler.error1(93, var3);
- }
-
- int var9 = this.fReader.addSymbol(var1, var2);
- int var4 = this.fParameterEntityPool.lookupEntity(var9);
- if (var4 < 0) {
- this.fErrorHandler.error1(94, var9);
- } else {
- this.fDocumentTypeHandler.parameterEntityDecl(var4);
- if (this.pushEntity((byte)1, var9)) {
- if (!this.fParameterEntityPool.isExternal(var4)) {
- StringReader var10 = new StringReader(this.fParserState, true, this.fReader, this.fParameterEntityPool.getEntityValue(var4));
- this.pushReader(var10, (InputSource)null);
- } else {
- int var5 = this.fParameterEntityPool.getPublicId(var4);
- int var6 = this.fParameterEntityPool.getSystemId(var4);
- var6 = this.fEntityHandler.expandSystemId(var6);
- InputSource var7 = this.fEntityHandler.resolveEntity(var5, var6);
- if (var7 == null) {
- var7 = new InputSource(this.fStringPool.toString(var6));
- if (var5 != -1) {
- var7.setPublicId(this.fStringPool.toString(var5));
- }
- }
-
- XMLReader var8 = this.fEntityHandler.createReader(var7, false);
- this.fEntityHandler.startInputSource(var7);
- this.pushReader(var8, var7);
- }
- }
- }
- }
-
- private boolean checkSkippedChar(char var1, boolean var2) throws Exception {
- while(true) {
- try {
- boolean var3 = this.fReader.skippedChar(var1);
- return var3;
- } catch (ArrayIndexOutOfBoundsException var4) {
- this.popReader();
- --this.fEntityStackDepth;
- if (var2) {
- this.fReader.skipPastSpaces();
- }
- }
- }
- }
-
- private boolean checkSkippedSpace() throws Exception {
- while(true) {
- try {
- boolean var1 = this.fReader.skippedSpace();
- return var1;
- } catch (ArrayIndexOutOfBoundsException var2) {
- this.popReader();
- --this.fEntityStackDepth;
- }
- }
- }
-
- private int checkSkipPastSpaces() throws Exception {
- while(true) {
- try {
- int var1 = this.fReader.skipPastSpaces();
- return var1;
- } catch (ArrayIndexOutOfBoundsException var2) {
- this.popReader();
- --this.fEntityStackDepth;
- }
- }
- }
-
- private boolean checkForPEReference(boolean var1) throws Exception {
- boolean var2 = true;
- if (var1) {
- try {
- var2 = this.fReader.skippedSpace();
- } catch (ArrayIndexOutOfBoundsException var7) {
- this.popReader();
- --this.fEntityStackDepth;
- var2 = this.fReader.skippedSpace();
- if (var2) {
- this.fReader.skipPastSpaces();
- }
- }
- }
-
- while(true) {
- try {
- this.fReader.skipPastSpaces();
- break;
- } catch (ArrayIndexOutOfBoundsException var6) {
- this.popReader();
- --this.fEntityStackDepth;
- if (!var2) {
- var2 = this.fReader.skippedSpace();
- }
- }
- }
-
- if (this.fScannerState != 3) {
- return var2;
- } else {
- boolean var3;
- while(true) {
- try {
- var3 = this.fReader.skippedChar('%');
- break;
- } catch (ArrayIndexOutOfBoundsException var5) {
- this.popReader();
- --this.fEntityStackDepth;
- if (!var2) {
- var2 = this.fReader.skippedSpace();
- }
-
- if (var2) {
- this.fReader.skipPastSpaces();
- }
- }
- }
-
- if (!var3) {
- return var2;
- } else {
- while(true) {
- this.expandPEReference();
-
- while(true) {
- try {
- this.fReader.skipPastSpaces();
- } catch (ArrayIndexOutOfBoundsException var4) {
- this.popReader();
- --this.fEntityStackDepth;
- continue;
- }
-
- var3 = this.checkSkippedChar('%', true);
- if (!var3) {
- return true;
- }
- break;
- }
- }
- }
- }
- }
-
- private boolean checkForPEDecl() throws Exception {
- boolean var1 = this.checkSkippedSpace();
- if (var1) {
- while(true) {
- try {
- this.fReader.skipPastSpaces();
- break;
- } catch (ArrayIndexOutOfBoundsException var10) {
- this.popReader();
- --this.fEntityStackDepth;
- var1 = this.fReader.skippedSpace();
- if (var1) {
- this.fReader.skipPastSpaces();
- }
- }
- }
- }
-
- boolean var2;
- while(true) {
- try {
- var2 = this.fReader.skippedChar('%');
- break;
- } catch (ArrayIndexOutOfBoundsException var9) {
- this.popReader();
- --this.fEntityStackDepth;
- var1 = this.fReader.skippedSpace();
- if (var1) {
- this.fReader.skipPastSpaces();
- }
- }
- }
-
- if (!var2) {
- if (!var1) {
- this.fErrorHandler.error(115);
- }
-
- return false;
- } else if (this.fScannerState != 3 && !var1) {
- this.fErrorHandler.error(115);
- return false;
- } else {
- try {
- var1 = this.fReader.skippedSpace();
- } catch (ArrayIndexOutOfBoundsException var8) {
- this.popReader();
- --this.fEntityStackDepth;
- var1 = this.fReader.skippedSpace();
- if (var1) {
- this.fReader.skipPastSpaces();
- }
- }
-
- if (var1) {
- this.checkForPEReference(false);
- return true;
- } else if (this.fScannerState != 3) {
- this.fErrorHandler.error(115);
- return true;
- } else {
- while(true) {
- try {
- var2 = this.fReader.lookingAtChar('%');
- break;
- } catch (ArrayIndexOutOfBoundsException var7) {
- this.popReader();
- --this.fEntityStackDepth;
- var1 = this.fReader.skippedSpace();
- if (var1) {
- this.fReader.skipPastSpaces();
- }
- }
- }
-
- if (var2) {
- this.checkForPEReference(false);
- return true;
- } else {
- boolean var3 = false;
-
- while(true) {
- this.expandPEReference();
-
- while(true) {
- try {
- this.fReader.skipPastSpaces();
- break;
- } catch (ArrayIndexOutOfBoundsException var4) {
- this.popReader();
- --this.fEntityStackDepth;
- this.fReader.skipPastSpaces();
- }
- }
-
- var2 = this.checkSkippedChar('%', true);
- if (!var2) {
- return var3;
- }
-
- if (!var3) {
- while(true) {
- try {
- var1 = this.fReader.skippedSpace();
- break;
- } catch (ArrayIndexOutOfBoundsException var5) {
- this.popReader();
- --this.fEntityStackDepth;
- }
- }
-
- if (var1) {
- this.checkForPEReference(false);
- return true;
- }
-
- while(true) {
- try {
- var2 = this.fReader.skippedChar('%');
- break;
- } catch (ArrayIndexOutOfBoundsException var6) {
- this.popReader();
- --this.fEntityStackDepth;
- var1 = this.fReader.skippedSpace();
- if (var1) {
- this.fReader.skipPastSpaces();
- }
- }
- }
-
- if (var2) {
- var3 = true;
- }
- }
- }
- }
- }
- }
- }
-
- private void scanMarkupDecl(boolean var1) throws Exception {
- ++this.fScannerMarkupDepth;
-
- try {
- if (this.fReader.skippedChar('!')) {
- if (this.fReader.skippedChar('-')) {
- if (this.fReader.skippedChar('-')) {
- this.scanComment(false);
- } else {
- this.fErrorHandler.error(20);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else if (this.fReader.skippedChar('[')) {
- if (this.fScannerState != 3) {
- this.fErrorHandler.error(47);
- }
-
- this.checkForPEReference(false);
- if (this.fReader.skippedString(include_string)) {
- this.checkForPEReference(false);
- if (!this.checkSkippedChar('[', true)) {
- this.fErrorHandler.error(23);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- this.scanExtSubsetDecl(true);
- }
- } else if (this.fReader.skippedString(ignore_string)) {
- this.checkForPEReference(false);
- if (!this.checkSkippedChar('[', true)) {
- this.fErrorHandler.error(23);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- this.scanIgnoreSectContents();
- }
- } else {
- this.fErrorHandler.error(23);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else if (this.fReader.skippedString(element_string)) {
- this.scanElementDecl();
- } else if (this.fReader.skippedString(attlist_string)) {
- this.scanAttlistDecl();
- } else if (this.fReader.skippedString(entity_string)) {
- this.scanEntityDecl();
- } else if (this.fReader.skippedString(notation_string)) {
- this.scanNotationDecl();
- } else {
- this.fErrorHandler.error(46);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else if (this.fReader.skippedChar('?')) {
- int var2 = this.fReader.scanName(' ', -1);
- if (var2 == -1) {
- this.fErrorHandler.error(102);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else if ("xml".equals(this.fStringPool.toString(var2))) {
- if (this.fReader.skippedSpace()) {
- if (var1) {
- this.scanTextDecl();
- } else {
- this.fErrorHandler.error(117);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else {
- this.fErrorHandler.error(107);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } else {
- this.scanPI(var2, false);
- }
- } else {
- this.fErrorHandler.error(25);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- }
- } catch (ArrayIndexOutOfBoundsException var3) {
- if ((this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1]) == 0) {
- --this.fScannerMarkupDepth;
- }
-
- throw var3;
- }
- }
-
- private void scanIgnoreSectContents() throws Exception {
- int var1 = 0;
-
- try {
- while(true) {
- while(!this.fReader.skippedChar('<')) {
- if (!this.fReader.skippedChar(']')) {
- if (!this.fReader.skippedValidChar()) {
- this.fReader.skipInvalidChar(85);
- }
- } else if (this.fReader.skippedChar(']')) {
- while(this.fReader.skippedChar(']')) {
- }
-
- if (this.fReader.skippedChar('>') && var1-- == 0) {
- --this.fScannerMarkupDepth;
- return;
- }
- }
- }
-
- if (this.fReader.skippedChar('!') && this.fReader.skippedChar('[')) {
- ++var1;
- }
- }
- } catch (ArrayIndexOutOfBoundsException var3) {
- this.fErrorHandler.error(24);
- throw var3;
- }
- }
-
- private void scanElementDecl() throws Exception {
- if (this.fStop) {
- throw new StopException(this);
- } else if (!this.checkForPEReference(true)) {
- this.fErrorHandler.error(115);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- int var1 = this.fReader.currentOffset();
-
- int var2;
- while(true) {
- try {
- var2 = this.fReader.skipPastName(' ') - var1;
- break;
- } catch (ArrayIndexOutOfBoundsException var5) {
- this.popReader();
- --this.fEntityStackDepth;
- var1 = this.fReader.skipPastSpaces();
- }
- }
-
- if (var2 == 0) {
- this.fErrorHandler.error(48);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- if (this.fElementDecl == null) {
- this.fElementDecl = new ElementDecl();
- }
-
- this.fElementDecl.elementName = this.fReader.addSymbol(var1, var2);
- if (!this.checkForPEReference(true)) {
- this.fErrorHandler.error(115);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else if (!this.scanContentSpec()) {
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- this.checkForPEReference(false);
- if (!this.checkSkippedChar('>', true)) {
- this.fErrorHandler.error(50);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- --this.fScannerMarkupDepth;
- int var3 = this.fElementDeclPool.addElementDecl(this.fElementDecl);
- if (this.fValidationHandler != null && var3 == -1) {
- int var4 = this.fElementDecl.elementName;
- this.fErrorHandler.error1(51, var4);
- } else {
- if (this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.elementDecl(var3);
- }
-
- }
- }
- }
- }
- }
- }
-
- private boolean scanContentSpec() throws Exception {
- if (this.fReader.skippedString(empty_string)) {
- this.fElementDecl.contentSpecType = 1;
- this.fElementDecl.contentSpec = -1;
- return true;
- } else if (this.fReader.skippedString(any_string)) {
- this.fElementDecl.contentSpecType = 2;
- this.fElementDecl.contentSpec = -1;
- return true;
- } else if (!this.fReader.skippedChar('(')) {
- this.fErrorHandler.error(49);
- return false;
- } else {
- int var1 = this.fScannerParenDepth++;
- this.checkForPEReference(false);
- boolean var2 = false;
-
- while(true) {
- try {
- var2 = this.fReader.skippedString(pcdata_string);
- break;
- } catch (ArrayIndexOutOfBoundsException var4) {
- this.popReader();
- --this.fEntityStackDepth;
- this.fReader.skipPastSpaces();
- }
- }
-
- if (this.fContentSpecNode == null) {
- this.fContentSpecNode = new ContentSpecNode();
- }
-
- this.fContentSpecNode.otherValue = -1;
- boolean var3 = var2 ? this.scanMixed() : this.scanChildren();
- if (!var3) {
- this.fScannerParenDepth = var1;
- }
-
- return var3;
- }
- }
-
- private boolean scanMixed() throws Exception {
- int var1 = -1;
- int var2 = -1;
- boolean var3 = false;
-
- while(true) {
- this.fContentSpecNode.type = 0;
- this.fContentSpecNode.value = var1;
- int var4 = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- this.checkForPEReference(false);
- if (!this.checkSkippedChar('|', true)) {
- if (!this.checkSkippedChar(')', true)) {
- this.fErrorHandler.error(31);
- return false;
- }
-
- --this.fScannerParenDepth;
- if (var2 != -1) {
- this.fContentSpecNode.type = 4;
- this.fContentSpecNode.value = var2;
- this.fContentSpecNode.otherValue = var4;
- var4 = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- this.fContentSpecNode.otherValue = -1;
- }
-
- if (this.checkSkippedChar('*', false)) {
- this.fContentSpecNode.type = 2;
- this.fContentSpecNode.value = var4;
- var4 = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- } else if (var3) {
- int var8 = this.fStringPool.addString(this.fElementDeclPool.getContentSpecNodeAsString(var4));
- this.fErrorHandler.error1(37, var8);
- return false;
- }
-
- this.fElementDecl.contentSpecType = 3;
- this.fElementDecl.contentSpec = var4;
- return true;
- }
-
- if (var2 != -1) {
- this.fContentSpecNode.type = 4;
- this.fContentSpecNode.value = var2;
- this.fContentSpecNode.otherValue = var4;
- var4 = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- this.fContentSpecNode.otherValue = -1;
- }
-
- var2 = var4;
- var3 = true;
- this.checkForPEReference(false);
- int var5 = this.fReader.currentOffset();
-
- while(true) {
- int var6;
- try {
- var6 = this.fReader.skipPastName(')') - var5;
- } catch (ArrayIndexOutOfBoundsException var7) {
- this.popReader();
- --this.fEntityStackDepth;
- var5 = this.fReader.skipPastSpaces();
- continue;
- }
-
- if (var6 == 0) {
- this.fErrorHandler.error(33);
- return false;
- }
-
- var1 = this.fReader.addSymbol(var5, var6);
- break;
- }
- }
- }
-
- private boolean scanChildren() throws Exception {
- int var1 = 1;
- this.initializeContentModelStack(var1);
-
- while(true) {
- label92:
- for(; !this.checkSkippedChar('(', true); this.checkForPEReference(false)) {
- int var2 = this.fReader.currentOffset();
-
- int var3;
- while(true) {
- try {
- var3 = this.fReader.skipPastName(')') - var2;
- break;
- } catch (ArrayIndexOutOfBoundsException var7) {
- this.popReader();
- --this.fEntityStackDepth;
- var2 = this.fReader.skipPastSpaces();
- }
- }
-
- if (var3 == 0) {
- if (this.fScannerState != 3 && this.fReader.lookingAtChar('%')) {
- this.fErrorHandler.error(96);
- } else {
- this.fErrorHandler.error(33);
- }
-
- return false;
- }
-
- int var4 = this.fReader.addSymbol(var2, var3);
- this.fContentSpecNode.type = 0;
- this.fContentSpecNode.value = var4;
- this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- if (this.fReader.skippedChar('?')) {
- this.fContentSpecNode.type = 1;
- this.fContentSpecNode.value = this.nodeIndexStack[var1];
- this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- } else if (this.fReader.skippedChar('*')) {
- this.fContentSpecNode.type = 2;
- this.fContentSpecNode.value = this.nodeIndexStack[var1];
- this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- } else if (this.fReader.skippedChar('+')) {
- this.fContentSpecNode.type = 3;
- this.fContentSpecNode.value = this.nodeIndexStack[var1];
- this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- }
-
- do {
- this.checkForPEReference(false);
- if (this.checkSkippedChar('|', true)) {
- if (this.prevNodeIndexStack[var1] != -1) {
- this.fContentSpecNode.type = this.opStack[var1];
- this.fContentSpecNode.value = this.prevNodeIndexStack[var1];
- this.fContentSpecNode.otherValue = this.nodeIndexStack[var1];
- this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- this.fContentSpecNode.otherValue = -1;
- }
-
- this.prevNodeIndexStack[var1] = this.nodeIndexStack[var1];
- if (this.opStack[var1] == 5) {
- int var9 = this.fStringPool.addString("|");
- int var10 = this.fStringPool.addString(",");
- this.fErrorHandler.error2(34, var9, var10);
- }
-
- this.opStack[var1] = 4;
- continue label92;
- }
-
- if (this.checkSkippedChar(',', true)) {
- if (this.prevNodeIndexStack[var1] != -1) {
- this.fContentSpecNode.type = this.opStack[var1];
- this.fContentSpecNode.value = this.prevNodeIndexStack[var1];
- this.fContentSpecNode.otherValue = this.nodeIndexStack[var1];
- this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- this.fContentSpecNode.otherValue = -1;
- }
-
- this.prevNodeIndexStack[var1] = this.nodeIndexStack[var1];
- if (this.opStack[var1] == 4) {
- int var8 = this.fStringPool.addString(",");
- int var6 = this.fStringPool.addString("|");
- this.fErrorHandler.error2(34, var8, var6);
- }
-
- this.opStack[var1] = 5;
- continue label92;
- }
-
- if (!this.checkSkippedChar(')', true)) {
- this.fErrorHandler.error(31);
- }
-
- --this.fScannerParenDepth;
- if (this.prevNodeIndexStack[var1] != -1) {
- this.fContentSpecNode.type = this.opStack[var1];
- this.fContentSpecNode.value = this.prevNodeIndexStack[var1];
- this.fContentSpecNode.otherValue = this.nodeIndexStack[var1];
- this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- this.fContentSpecNode.otherValue = -1;
- }
-
- int var5 = this.nodeIndexStack[var1--];
- this.nodeIndexStack[var1] = var5;
- if (this.fReader.skippedChar('?')) {
- this.fContentSpecNode.type = 1;
- this.fContentSpecNode.value = this.nodeIndexStack[var1];
- this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- } else if (this.fReader.skippedChar('*')) {
- this.fContentSpecNode.type = 2;
- this.fContentSpecNode.value = this.nodeIndexStack[var1];
- this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- } else if (this.fReader.skippedChar('+')) {
- this.fContentSpecNode.type = 3;
- this.fContentSpecNode.value = this.nodeIndexStack[var1];
- this.nodeIndexStack[var1] = this.fElementDeclPool.addContentSpecNode(this.fContentSpecNode);
- }
- } while(var1 != 0);
-
- this.fElementDecl.contentSpecType = 4;
- this.fElementDecl.contentSpec = this.nodeIndexStack[0];
- return true;
- }
-
- ++this.fScannerParenDepth;
- this.checkForPEReference(false);
- ++var1;
- this.initializeContentModelStack(var1);
- }
- }
-
- private void scanAttlistDecl() throws Exception {
- if (!this.checkForPEReference(true)) {
- this.fErrorHandler.error(115);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- int var1 = this.fReader.currentOffset();
-
- int var2;
- while(true) {
- try {
- var2 = this.fReader.skipPastName(' ') - var1;
- break;
- } catch (ArrayIndexOutOfBoundsException var8) {
- this.popReader();
- --this.fEntityStackDepth;
- var1 = this.fReader.skipPastSpaces();
- }
- }
-
- if (var2 == 0) {
- this.fErrorHandler.error(11);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- int var3 = this.fReader.addSymbol(var1, var2);
- int var4 = this.fElementDeclPool.addElement(var3);
- if (this.fAttDef == null) {
- this.fAttDef = new AttDef();
- }
-
- while(true) {
- boolean var5 = this.checkForPEReference(true);
-
- while(true) {
- try {
- if (this.fReader.skippedChar('>')) {
- --this.fScannerMarkupDepth;
- return;
- }
- } catch (ArrayIndexOutOfBoundsException var7) {
- this.popReader();
- --this.fEntityStackDepth;
- if (var5) {
- this.fReader.skippedSpace();
- } else {
- var5 = this.fReader.skippedSpace();
- if (var5) {
- this.fReader.skipPastSpaces();
- }
- }
- continue;
- }
-
- if (!var5) {
- this.fErrorHandler.error(115);
- }
-
- if (!this.scanAttDef()) {
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- int var6 = this.fElementDeclPool.addAttDef(var4, this.fAttDef);
- if (var6 != -1 && this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.attlistDecl(var4, var6);
- }
- break;
- }
- }
- }
- }
- }
-
- private boolean scanAttDef() throws Exception {
- int var1 = this.fReader.currentOffset();
- int var2 = 0;
-
- while(true) {
- try {
- var2 = this.fReader.skipPastName(' ') - var1;
- break;
- } catch (ArrayIndexOutOfBoundsException var3) {
- this.popReader();
- --this.fEntityStackDepth;
- var1 = this.fReader.skipPastSpaces();
- }
- }
-
- if (var2 == 0) {
- this.fErrorHandler.error(2);
- return false;
- } else {
- this.fAttDef.attName = this.fReader.addSymbol(var1, var2);
- if (!this.checkForPEReference(true)) {
- this.fErrorHandler.error(115);
- return false;
- } else if (!this.scanAttType()) {
- return false;
- } else if (!this.checkForPEReference(true)) {
- this.fErrorHandler.error(115);
- return false;
- } else {
- return this.scanDefaultDecl();
- }
- }
- }
-
- private boolean scanAttType() throws Exception {
- this.fAttDef.enumeration = -1;
-
- while(true) {
- try {
- if (this.fReader.skippedString(cdata_string)) {
- this.fAttDef.attType = 0;
- } else if (this.fReader.skippedString(id_string)) {
- if (!this.fReader.skippedString(ref_string)) {
- this.fAttDef.attType = 1;
- } else if (!this.fReader.skippedChar('S')) {
- this.fAttDef.attType = 2;
- } else {
- this.fAttDef.attType = 3;
- }
- } else if (this.fReader.skippedString(entit_string)) {
- if (this.fReader.skippedChar('Y')) {
- this.fAttDef.attType = 4;
- } else if (this.fReader.skippedString(ies_string)) {
- this.fAttDef.attType = 5;
- } else {
- this.fErrorHandler.error(4);
- this.fReader.skipPastNmtoken(' ');
- }
- } else if (this.fReader.skippedString(nmtoken_string)) {
- if (this.fReader.skippedChar('S')) {
- this.fAttDef.attType = 7;
- } else {
- this.fAttDef.attType = 6;
- }
- } else if (this.fReader.skippedString(notation_string)) {
- this.fAttDef.attType = 8;
- if (!this.scanEnumeration(true)) {
- return false;
- }
- } else {
- if (!this.fReader.skippedChar('(')) {
- this.fErrorHandler.error(4);
- return false;
- }
-
- ++this.fScannerParenDepth;
- this.fAttDef.attType = 9;
- if (!this.scanEnumeration(false)) {
- return false;
- }
- }
-
- return true;
- } catch (ArrayIndexOutOfBoundsException var1) {
- this.popReader();
- --this.fEntityStackDepth;
- this.fReader.skipPastSpaces();
- }
- }
- }
-
- private boolean scanEnumeration(boolean var1) throws Exception {
- if (var1) {
- if (!this.checkForPEReference(true)) {
- this.fErrorHandler.error(115);
- return false;
- }
-
- while(true) {
- try {
- if (!this.fReader.skippedChar('(')) {
- this.fErrorHandler.error(71);
- return false;
- }
- } catch (ArrayIndexOutOfBoundsException var9) {
- this.popReader();
- --this.fEntityStackDepth;
- this.fReader.skipPastSpaces();
- continue;
- }
-
- ++this.fScannerParenDepth;
- break;
- }
- }
-
- this.fAttDef.enumeration = this.fStringPool.startStringList();
- boolean var2 = false;
-
- do {
- this.checkForPEReference(false);
- int var3 = this.fReader.currentOffset();
-
- int var4;
- while(true) {
- try {
- if (var1) {
- var4 = this.fReader.skipPastName(')') - var3;
- } else {
- var4 = this.fReader.skipPastNmtoken(')') - var3;
- }
- break;
- } catch (ArrayIndexOutOfBoundsException var6) {
- this.popReader();
- --this.fEntityStackDepth;
- var3 = this.fReader.skipPastSpaces();
- }
- }
-
- if (var4 == 0) {
- int var11 = var1 ? 72 : 73;
- this.fErrorHandler.error(var11);
- this.fStringPool.finishStringList(this.fAttDef.enumeration);
- return false;
- }
-
- int var5 = this.fReader.addSymbol(var3, var4);
- this.checkForPEReference(false);
-
- while(true) {
- try {
- var2 = this.fReader.skippedChar('|');
- break;
- } catch (ArrayIndexOutOfBoundsException var7) {
- this.popReader();
- --this.fEntityStackDepth;
- this.fReader.skipPastSpaces();
- }
- }
-
- if (!var2) {
- while(true) {
- try {
- if (!this.fReader.skippedChar(')')) {
- this.fErrorHandler.error(74);
- this.fStringPool.finishStringList(this.fAttDef.enumeration);
- return false;
- }
- } catch (ArrayIndexOutOfBoundsException var8) {
- this.popReader();
- --this.fEntityStackDepth;
- this.fReader.skipPastSpaces();
- continue;
- }
-
- --this.fScannerParenDepth;
- break;
- }
- }
-
- this.fStringPool.addStringToList(this.fAttDef.enumeration, var5);
- } while(var2);
-
- this.fStringPool.finishStringList(this.fAttDef.enumeration);
- return true;
- }
-
- private boolean scanDefaultDecl() throws Exception {
- if (this.fReader.skippedString(required_string)) {
- this.fAttDef.attDefaultType = 2;
- this.fAttDef.attValue = -1;
- return true;
- } else if (this.fReader.skippedString(implied_string)) {
- this.fAttDef.attDefaultType = 3;
- this.fAttDef.attValue = -1;
- return true;
- } else {
- if (this.fReader.skippedString(fixed_string)) {
- this.fAttDef.attDefaultType = 4;
- if (!this.fReader.skippedSpace()) {
- this.fErrorHandler.error(115);
- return false;
- }
-
- this.fReader.skipPastSpaces();
- } else {
- this.fAttDef.attDefaultType = 1;
- }
-
- if (!this.scanAttValue(-1, -1, this.fAttDef.attType, true, this.fAttDef.attDefaultType == 4, true)) {
- this.fErrorHandler.error(173);
- return false;
- } else {
- this.fAttDef.attValue = this.fAttValueIndex;
- return true;
- }
- }
- }
-
- private void scanNotationDecl() throws Exception {
- if (!this.checkForPEReference(true)) {
- this.fErrorHandler.error(115);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- int var1 = this.fReader.currentOffset();
-
- int var2;
- while(true) {
- try {
- var2 = this.fReader.skipPastName(' ') - var1;
- break;
- } catch (ArrayIndexOutOfBoundsException var5) {
- this.popReader();
- --this.fEntityStackDepth;
- var1 = this.fReader.skipPastSpaces();
- }
- }
-
- if (var2 == 0) {
- this.fErrorHandler.error(91);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- if (this.fNotationDecl == null) {
- this.fNotationDecl = new NotationDecl();
- }
-
- this.fNotationDecl.notationName = this.fReader.addSymbol(var1, var2);
- if (!this.checkForPEReference(true)) {
- this.fErrorHandler.error(115);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else if (!this.scanExternalIDorPublicID(true, true)) {
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- this.fNotationDecl.publicId = this.fPubidLiteral;
- this.fNotationDecl.systemId = this.fSystemLiteral;
- this.checkForPEReference(false);
-
- while(true) {
- try {
- if (!this.fReader.skippedChar('>')) {
- this.fErrorHandler.error(163);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- return;
- }
-
- --this.fScannerMarkupDepth;
- } catch (ArrayIndexOutOfBoundsException var4) {
- this.popReader();
- --this.fEntityStackDepth;
- this.fReader.skipPastSpaces();
- continue;
- }
-
- int var3 = this.fEntityPool.addNotationDecl(this.fNotationDecl);
- if (var3 != -1 && this.fDocumentTypeHandler != null) {
- this.fDocumentTypeHandler.notationDecl(var3);
- }
-
- return;
- }
- }
- }
- }
- }
-
- private void scanEntityDecl() throws Exception {
- boolean var1 = this.checkForPEDecl();
- int var2 = this.fReader.currentOffset();
-
- int var3;
- while(true) {
- try {
- var3 = this.fReader.skipPastName(' ') - var2;
- break;
- } catch (ArrayIndexOutOfBoundsException var8) {
- this.popReader();
- --this.fEntityStackDepth;
- var2 = this.fReader.skipPastSpaces();
- }
- }
-
- if (var3 == 0) {
- this.fErrorHandler.error(61);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- int var4 = this.fReader.addSymbol(var2, var3);
- boolean var5 = this.pushEntity((byte)(var1 ? 1 : 0), var4);
- if (!var5) {
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- } else {
- if (this.fEntityDecl == null) {
- this.fEntityDecl = new EntityDecl();
- }
-
- this.fEntityDecl.entityName = var4;
- this.fEntityDecl.entityValue = -1;
- this.fEntityDecl.publicId = -1;
- this.fEntityDecl.systemId = -1;
- this.fEntityDecl.notationName = -1;
- if (!this.checkForPEReference(true)) {
- this.fErrorHandler.error(115);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- --this.fEntityStackDepth;
- } else if (!(var1 ? this.scanPEDef() : this.scanEntityDef())) {
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- --this.fEntityStackDepth;
- } else {
- this.checkForPEReference(false);
-
- while(true) {
- try {
- if (!this.fReader.skippedChar('>')) {
- this.fErrorHandler.error(64);
- this.fReader.skipPastChar('>');
- --this.fScannerMarkupDepth;
- --this.fEntityStackDepth;
- return;
- }
-
- --this.fScannerMarkupDepth;
- } catch (ArrayIndexOutOfBoundsException var7) {
- this.popReader();
- --this.fEntityStackDepth;
- this.fReader.skipPastSpaces();
- continue;
- }
-
- --this.fEntityStackDepth;
- if (var1) {
- if (this.fParameterEntityPool == null) {
- this.fParameterEntityPool = new DefaultEntityPool(this.fParserState, false);
- this.fParserState.setParameterEntityPool(this.fParameterEntityPool);
- }
-
- int var9 = this.fParameterEntityPool.addEntityDecl(this.fEntityDecl);
- this.fDocumentTypeHandler.parameterEntityDecl(var9);
- return;
- }
-
- int var6 = this.fEntityPool.addEntityDecl(this.fEntityDecl);
- if (this.fDocumentTypeHandler != null) {
- if (this.fEntityDecl.entityValue == -1) {
- if (this.fEntityDecl.notationName == -1) {
- this.fDocumentTypeHandler.externalEntityDecl(var6);
- return;
- }
-
- this.fDocumentTypeHandler.unparsedEntityDecl(var6);
- return;
- }
-
- this.fDocumentTypeHandler.internalEntityDecl(var6);
- }
-
- return;
- }
- }
- }
- }
- }
-
- private boolean scanEntityDef() throws Exception {
- boolean var1;
- if (!(var1 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- if (!this.scanExternalIDorPublicID(true, false)) {
- return false;
- } else {
- this.fEntityDecl.publicId = this.fPubidLiteral;
- this.fEntityDecl.systemId = this.fSystemLiteral;
- if (!this.fReader.skippedSpace()) {
- return true;
- } else {
- this.fReader.skipPastSpaces();
- if (this.fReader.skippedString(ndata_string)) {
- if (!this.fReader.skippedSpace()) {
- this.fErrorHandler.error(115);
- return false;
- }
-
- int var2 = this.fReader.skipPastSpaces();
- int var3 = this.fReader.skipPastName('>') - var2;
- if (var3 == 0) {
- this.fErrorHandler.error(65);
- return false;
- }
-
- this.fEntityDecl.notationName = this.fReader.addSymbol(var2, var3);
- }
-
- return true;
- }
- }
- } else {
- return this.scanEntityValue(var1);
- }
- }
-
- private boolean scanPEDef() throws Exception {
- boolean var1;
- if (!(var1 = this.fReader.skippedChar('\'')) && !this.fReader.skippedChar('"')) {
- if (!this.scanExternalIDorPublicID(true, false)) {
- return false;
- } else {
- this.fEntityDecl.publicId = this.fPubidLiteral;
- this.fEntityDecl.systemId = this.fSystemLiteral;
- return true;
- }
- } else {
- return this.scanEntityValue(var1);
- }
- }
-
- private boolean scanEntityValue(boolean var1) throws Exception {
- int var2 = this.fReader.currentOffset();
- int var3 = var1 ? 39 : 34;
- int var4 = var2;
- int var5 = this.fLiteralData.length();
-
- while(!this.fReader.skippedChar((char)var3)) {
- if (this.fReader.skippedChar('&')) {
- if (var2 - var4 > 0) {
- this.fReader.append(this.fLiteralData, var4, var2 - var4);
- }
-
- var2 = this.referenceInEntityValue(var2, true);
- var4 = var2;
- } else if (this.fReader.skippedChar('%')) {
- if (var2 - var4 > 0) {
- this.fReader.append(this.fLiteralData, var4, var2 - var4);
- }
-
- if (!this.copyPEReference()) {
- this.fReader.skipToChar((char)var3);
- return false;
- }
-
- var2 = this.fReader.currentOffset();
- var4 = var2;
- } else {
- if (!this.fReader.skippedValidChar()) {
- this.fReader.skipInvalidChar(63);
- this.fReader.skipToChar((char)var3);
- return false;
- }
-
- var2 = this.fReader.currentOffset();
- }
- }
-
- if (var2 - var4 > 0) {
- this.fReader.append(this.fLiteralData, var4, var2 - var4);
- }
-
- int var6 = this.fLiteralData.length() - var5;
- this.fEntityDecl.entityValue = this.fLiteralData.addString(var5, var6);
- return true;
- }
-
- private void growReaderStack() {
- XMLReader[] var1 = new XMLReader[this.fReaderStackDepth * 2];
- System.arraycopy(this.fReaderStack, 0, var1, 0, this.fReaderStackDepth);
- this.fReaderStack = var1;
- InputSource[] var2 = new InputSource[this.fReaderStackDepth * 2];
- System.arraycopy(this.fReaderSource, 0, var2, 0, this.fReaderStackDepth);
- this.fReaderSource = var2;
- int[] var3 = new int[this.fReaderStackDepth * 2];
- System.arraycopy(this.fReaderMarkupDepth, 0, var3, 0, this.fReaderStackDepth);
- this.fReaderMarkupDepth = var3;
- var3 = new int[this.fReaderStackDepth * 2];
- System.arraycopy(this.fReaderParenDepth, 0, var3, 0, this.fReaderStackDepth);
- this.fReaderParenDepth = var3;
- }
-
- private int pushReader(XMLReader var1, InputSource var2) {
- if (this.fReaderStackDepth == this.fReaderStack.length) {
- this.growReaderStack();
- }
-
- this.fReaderStack[this.fReaderStackDepth] = this.fReader;
- this.fReaderSource[this.fReaderStackDepth] = var2;
- this.fReaderMarkupDepth[this.fReaderStackDepth] = this.fScannerMarkupDepth;
- this.fReaderParenDepth[this.fReaderStackDepth] = this.fScannerParenDepth;
- this.fReader = var1;
- return ++this.fReaderStackDepth;
- }
-
- private void popReader() throws Exception {
- if (this.fReaderStackDepth == this.fActiveReaderLimit) {
- throw new ArrayIndexOutOfBoundsException();
- } else {
- --this.fReaderStackDepth;
- int var1 = this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1];
- if (var1 != 0) {
- if (this.fValidationHandler != null && this.fScannerParenDepth != this.fReaderParenDepth[this.fReaderStackDepth]) {
- this.fErrorHandler.error1(99, var1);
- }
-
- if (this.fScannerMarkupDepth != this.fReaderMarkupDepth[this.fReaderStackDepth]) {
- if ((this.fEntityStackDepth == 0 ? 0 : this.fEntityTypeStack[this.fEntityStackDepth - 1]) == 0) {
- this.fErrorHandler.error(138);
- } else {
- this.fErrorHandler.error1(101, var1);
- }
- }
- }
-
- this.fReader = this.fReaderStack[this.fReaderStackDepth];
- InputSource var2 = this.fReaderSource[this.fReaderStackDepth];
- if (var2 != null) {
- this.fEntityHandler.endInputSource(var2);
- this.fReaderSource[this.fReaderStackDepth] = null;
- }
-
- }
- }
-
- private int setActiveReaderLimit(int var1) {
- int var2 = this.fActiveReaderLimit;
- this.fActiveReaderLimit = var1;
- return var2;
- }
-
- private int increaseParenDepth() {
- return this.fScannerParenDepth++;
- }
-
- private int decreaseParenDepth() {
- return this.fScannerParenDepth--;
- }
-
- private int increaseMarkupDepth() {
- return this.fScannerMarkupDepth++;
- }
-
- private int decreaseMarkupDepth() {
- return this.fScannerMarkupDepth--;
- }
-
- private void pushElementName(int var1) {
- if (this.fElementDepth >= 0) {
- int[] var2 = this.fElementChildren[this.fElementDepth];
- int var3 = this.fElementChildCount[this.fElementDepth];
- if (var2 == null) {
- var2 = this.fElementChildren[this.fElementDepth] = new int[8];
- var3 = 0;
- } else if (var3 == var2.length) {
- int[] var4 = new int[var3 * 2];
- System.arraycopy(var2, 0, var4, 0, var3);
- var2 = this.fElementChildren[this.fElementDepth] = var4;
- }
-
- var2[var3++] = var1;
- this.fElementChildCount[this.fElementDepth] = var3;
- }
-
- ++this.fElementDepth;
- if (this.fElementDepth == this.fElementNameStack.length) {
- int[] var5 = new int[this.fElementDepth * 2];
- System.arraycopy(this.fElementNameStack, 0, var5, 0, this.fElementDepth);
- this.fElementNameStack = var5;
- var5 = new int[this.fElementDepth * 2];
- System.arraycopy(this.fElementChildCount, 0, var5, 0, this.fElementDepth);
- this.fElementChildCount = var5;
- int[][] var8 = new int[this.fElementDepth * 2][];
- System.arraycopy(this.fElementChildren, 0, var8, 0, this.fElementDepth);
- this.fElementChildren = var8;
- }
-
- this.fElementNameStack[this.fElementDepth] = var1;
- this.fElementChildCount[this.fElementDepth] = 0;
- }
-
- private int elementStackDepth() {
- return this.fElementDepth;
- }
-
- private void charDataInContent() {
- int[] var1 = this.fElementChildren[this.fElementDepth];
- int var2 = this.fElementChildCount[this.fElementDepth];
- if (var1 == null) {
- var1 = this.fElementChildren[this.fElementDepth] = new int[8];
- var2 = 0;
- } else if (var2 == var1.length) {
- int[] var3 = new int[var2 * 2];
- System.arraycopy(var1, 0, var3, 0, var2);
- var1 = this.fElementChildren[this.fElementDepth] = var3;
- }
-
- var1[var2++] = -1;
- this.fElementChildCount[this.fElementDepth] = var2;
- }
-
- public int getCurrentContentSpecType() {
- return this.fElementDeclPool.getContentSpecType(this.fElementDeclPool.getElement(this.fElementNameStack[this.fElementDepth]));
- }
-
- private int peekElementName() {
- return this.fElementNameStack[this.fElementDepth];
- }
-
- private int peekChildCount() {
- return this.fElementChildCount[this.fElementDepth];
- }
-
- private int[] peekChildren() {
- return this.fElementChildren[this.fElementDepth];
- }
-
- private boolean popElementName() {
- if (this.fElementDepth < 0) {
- throw new RuntimeException("Element stack underflow");
- } else {
- return --this.fElementDepth >= 0;
- }
- }
-
- private boolean pushEntity(byte var1, int var2) throws Exception {
- for(int var3 = 0; var3 < this.fEntityStackDepth; ++var3) {
- if (this.fEntityNameStack[var3] == var2 && this.fEntityTypeStack[var3] == var1) {
- int var4 = var1 == 0 ? 139 : 97;
- int var5 = this.entityReferencePath(var1, var2);
- this.fErrorHandler.error2(var4, var2, var5);
- return false;
- }
- }
-
- if (this.fEntityTypeStack == null) {
- this.fEntityTypeStack = new byte[8];
- this.fEntityNameStack = new int[8];
- } else if (this.fEntityStackDepth == this.fEntityTypeStack.length) {
- byte[] var6 = new byte[this.fEntityStackDepth * 2];
- System.arraycopy(this.fEntityTypeStack, 0, var6, 0, this.fEntityStackDepth);
- this.fEntityTypeStack = var6;
- int[] var7 = new int[this.fEntityStackDepth * 2];
- System.arraycopy(this.fEntityNameStack, 0, var7, 0, this.fEntityStackDepth);
- this.fEntityNameStack = var7;
- }
-
- this.fEntityTypeStack[this.fEntityStackDepth] = var1;
- this.fEntityNameStack[this.fEntityStackDepth] = var2;
- ++this.fEntityStackDepth;
- return true;
- }
-
- private int peekEntity() {
- return this.fEntityStackDepth == 0 ? 0 : this.fEntityNameStack[this.fEntityStackDepth - 1];
- }
-
- private int peekEntityType() {
- return this.fEntityStackDepth == 0 ? 0 : this.fEntityTypeStack[this.fEntityStackDepth - 1];
- }
-
- private int entityReferencePath(byte var1, int var2) {
- StringBuffer var3 = new StringBuffer();
- var3.append("(top-level)");
-
- for(int var4 = 0; var4 < this.fEntityStackDepth; ++var4) {
- var3.append('-');
- var3.append((char)(this.fEntityTypeStack[var4] == 0 ? '&' : '%'));
- var3.append(this.fStringPool.toString(this.fEntityNameStack[var4]));
- var3.append(';');
- }
-
- var3.append('-');
- var3.append((char)(var1 == 0 ? '&' : '%'));
- var3.append(this.fStringPool.toString(var2));
- var3.append(';');
- return this.fStringPool.addString(var3.toString());
- }
-
- private void popEntity() {
- --this.fEntityStackDepth;
- }
-
- private void initializeContentModelStack(int var1) {
- if (this.opStack == null) {
- this.opStack = new byte[8];
- this.nodeIndexStack = new int[8];
- this.prevNodeIndexStack = new int[8];
- } else if (var1 == this.opStack.length) {
- byte[] var2 = new byte[var1 * 2];
- System.arraycopy(this.opStack, 0, var2, 0, var1);
- this.opStack = var2;
- int[] var3 = new int[var1 * 2];
- System.arraycopy(this.nodeIndexStack, 0, var3, 0, var1);
- this.nodeIndexStack = var3;
- var3 = new int[var1 * 2];
- System.arraycopy(this.prevNodeIndexStack, 0, var3, 0, var1);
- this.prevNodeIndexStack = var3;
- }
-
- this.opStack[var1] = 0;
- this.nodeIndexStack[var1] = -1;
- this.prevNodeIndexStack[var1] = -1;
- }
- }
-